|
jareyesb
|
 |
« on: January 23, 2009, 06:18:13 PM » |
|
Hi everyone,
I know that this is a question that i made before yesterday but until now i implement the answer that steven gave me, but it doesnt work, i'm pretty sure that i am making a mistake but either i want to show my code.
i want to set the backgroundColor of a row depending of certain value of a cell so i have this (function gridCompleted(grid) is what Steven said):
<script type="text/javascript"> <!-- var grid_demo_id = ""; var dsOption = ""; var colsOption = ""; var gridOption = "";
function asignaVariables() { grid_demo_id = "myGrid1" ; dsOption= { fields :[ {name : 'PMM_DATETIME' ,type:'date'}, {name : 'RED' }, {name : 'BEST' }, {name : 'BKP1' }, {name : 'BKP2' }, {name : 'BKP3' } ], recordType : 'array' } colsOption = [ {id: 'PMM_DATETIME' , header: "Fecha" , width :120 }, {id: 'RED' , header: "Red" , width :110 }, {id: 'BEST' , header: "Best" , width :160 }, {id: 'BKP1' , header: "BackUp 1" , width :160}, {id: 'BKP2' , header: "BackUp 2" , width :160}, {id: 'BKP3' , header: "BackUp 3" , width :160} ];
gridOption={ id : grid_demo_id, loadURL : 'main-controller.php', saveURL : 'main-controller.php', parameters : {crouter: document.getElementById("router").value}, //Amsterdam RRC001 New York RRC111 width: "1000", //"100%", // 700, height: "500", //"100%", // 330, container : 'gridbox', replaceContainer : true, encoding : 'UTF-8', // Sigma.$encoding(), dataset : dsOption , columns : colsOption , pageSize:100, toolbarContent : 'nav | pagesize | reload print state', skin: 'mac' }; }
function consultaDatos() { document.getElementById("content").innerHTML = '<div id="gridbox" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:500px;width:1000px;" ></div>'; var mygrid=new Sigma.Grid( gridOption ); mygrid.render(); //Sigma.Util.onLoad(function(){mygrid.render()}); }
function gridCompleted(grid){ var trArray = Sigma.Grid.getAllRows(grid); for(var i=0;i<trArray.length;i++){ data = grid.getRecord(i); if(data[4] == " - "){ trArray.style.backgroundColor = "red"; } } }
function window_onload() { asignaVariables(); consultaDatos(); gridCompleted('myGrid1'); }
//--> </script>
|