Set Column Color

I’m trying to set the background color of a single column in my grid to yellow using this post as a guide: http://forum.dhtmlx.com/viewtopic.php?f=2&t=26945&p=85355

	var mygrid = new dhtmlXGridObject('detail');
	mygrid.setImagePath("dhtmlx/codebase/imgs/");
	mygrid.setHeader("yearnum,monthnum,categoryID,categoryname,campusname,Contract #, Contract Type,Company, Award Amount, Approved Changes, Spent to Date, Balance, Spent in <?php echo MonthName($intMonth,true)?>");
	mygrid.setColumnIds("yearnum,monthnum,categoryID,categoryname,campusname,contractnum,contracttype,company,awardamount,approvedchanges,todate,balance,thisPeriod");
	mygrid.setInitWidths("50,50,50,50,50,75,75,*,95,95,95,95,95");
	mygrid.setColAlign("left,left,left,left,left,left,left,left,right,right,right,right,right");
	mygrid.setColSorting("str,str,str,str,str,str,str,str,int,int,int,int,int");
	mygrid.setNumberFormat("$0,000", 8);
	mygrid.setNumberFormat("$0,000", 9);
	mygrid.setNumberFormat("$0,000", 10);
	mygrid.setNumberFormat("$0,000", 11);
	mygrid.setNumberFormat("$0,000", 12);
	mygrid.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ron,ron,ron,ron[=c8+c9-c10],ron");
	mygrid.setMathRound(0);
	mygrid.setColumnHidden(0,true);
	mygrid.setColumnHidden(1,true);
	mygrid.setColumnHidden(2,true);
	mygrid.setColumnHidden(3,true);
	mygrid.setColumnHidden(4,true);
	mygrid.setSkin("dhx_skyblue");
	mygrid.init();	
	mygrid.loadXML("Data_CampusCategoryDT.php?year=" + intYear + "&month=" + intMonth + "&catID=" + intCatID + "&campus=" + escape(strCampus)); //LOAD XML DATA 
		for (var i = 0; 
			i < mygrid.getRowsNum(); i++) {
			mygrid.setCellTextStyle(i,11,"background-color:yellow");			
			} 

The grid renders, data populates, but none of the cells change color. Thanks in advance.

Please, try to call your loop from a callback of the load() method:

mygrid.loadXML("Data_CampusCategoryDT.php?year=" + intYear + "&month=" + intMonth + "&catID=" + intCatID + "&campus=" + escape(strCampus), function(){ for (var i = 0; i < mygrid.getRowsNum(); i++) { mygrid.setCellTextStyle(i,11,"background-color:yellow"); } }); //LOAD XML DATA

Also you may use setColumnColor() method:
docs.dhtmlx.com/doku.php?id=dhtm … olumncolor

I ended up going with setColumnColor. I don’t know how I missed that. Thanks!