I am loading data using xml from the server side script. I already have it set to display a row green if the stored checkbox value from the server is true. This works just fine. However, if a user checks the box from the grid, I want the row to change color dynamically without refreshing the page…
The following is the code for my grid configuration:
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("./dhtmlx_502_pro/skins/web/imgs/");
mygrid.setHeader("HOT,WO,RQD Date,REV Ship,CR Start Date,Prod Stage,Customer,Part Number,PO Number,Ft<sup>2</sup>,#,CR1,CR2,CR % Cplt,Floor Notes,Client's Notes,Production Notes,Status, sgref");
mygrid.attachHeader(" ,#text_filter, ,#cspan,#cspan,#text_filter,#text_filter, ,#text_filter, ,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#text_filter, ,");
mygrid.setInitWidthsP("2,6,6,6,6,8.5,10,10,8,4,3,3,3,3,4,*,9,11,0");
mygrid.setColAlign("center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center");
mygrid.setColTypes("ch,ro,ro,dhxCalendar,dhxCalendar,coro,ro,ro,ro,ro,ro,ro,ro,ro,ro,txt,txt,coro,ro");
mygrid.setColSorting("str,int,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str"); mygrid.setColumnIds("colorhot,workorder,requireddate,revdate,cleanroom_start,productionstage,customer,partnumber,ponumber,totalsqft,quantity,claveid,claveid2,scanpercent,floornotes,clientnotes,productionnotes,stagestatus,sgref");
mygrid.setDateFormat("%y-%m-%d", "%Y-%m-%d");
var combobox = mygrid.getCombo(17);
combobox.put("Scheduling","Scheduling")
combobox.put("On Board","On Board")
combobox.put("Production","Production")
combobox.put("Shipping: On Hold","Shipping: On Hold")
combobox.put("Shipping: Needs BOL","Shipping: Needs BOL")
combobox.put("Shipped For Fabrication","Shipped For Fabrication")
var combobox = mygrid.getCombo(5);
combobox.put("Please Select","Please Select")
combobox.put("Staged Done","Staged Done")
combobox.put("Cleanroom Done","Cleanroom Done")
combobox.put("GB2 Done","GB2 Done")
combobox.put("Bagging/Clave Done","Bagging/Clave Done")
combobox.put("Inspection Done","Inspection Done")
combobox.put("LC Inspection Done","LC Inspection Done")
combobox.put("IGU Done","IGU Done")
mygrid.attachEvent("isChecked",isChecked);
mygrid.attachEvent("onCellMarked",doOnCellSelected);
mygrid.enableMarkedCells(true);
mygrid.enableBlockSelection(true);
mygrid.enableRowsHover(true,'grid_hover');
mygrid.init();
//============================================================================================
mygrid.load("get_production_alt_pittsfield.php");
myDataProcessor = new dataProcessor("updateHOLD_alt.php");
// myDataProcessor.enableDebug(true);
myDataProcessor.enableDataNames(true);
// myDataProcessor.setVerificator(1)
// myDataProcessor.setVerificator(3,checkIfNotZero)
myDataProcessor.setUpdateMode("cell");//available values: cell (default), row, off
// myDataProcessor.defineAction("error",myErrorHandler);
myDataProcessor.setTransactionMode("GET");
myDataProcessor.init(mygrid);
//============================================================================================
function doOnCellSelected(rid,ind) {
if (ind == 14) {
var sgref = mygrid.cells(rid,18).getValue();
var dhxWins = new dhtmlXWindows();
wFloornotes = dhxWins.createWindow("wFloornotes", 100, 100, 459, 448);
wFloornotes.setText("Floornotes");
wFloornotes.center();
wFloornotes.attachURL('floornotes_datalist.php', null, {sgref: sgref});
}
}
function isChecked(rid,ind) { //// NOTE: I have also tried mygrid.cells(rid,ind).isChecked() as well and neither works... ////
var checked = mygrid.cells(rid,0).getValue();
if (checked == 1) {
mygrid.cells(rid,0).setBgColor('#90EE90');
}
}
</script>