Categories | Question details Back To List | ||
setHeader problem I'm trying to dynamically reset the header on an onRowSelect event but my setHeader isn't working. Here the code: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv asset_grid = new dhtmlXGridObject('asset_div'); asset_grid.enableDragAndDrop(true); asset_grid.enableMercyDrag(true); asset_grid.setImagePath("js/dhtmlxGrid/imgs/"); asset_grid.setSkin("light"); asset_grid.setHeader("Applicable Process Groups"); asset_grid.setInitWidths("210"); asset_grid.setColAlign("left"); asset_grid.setColTypes("ro"); asset_grid.init(); asset_grid.loadXML("load_assets.php?option_id="+option_id); ... option_grid = new dhtmlXGridObject('option_div'); option_grid.enableTreeCellEdit(false); option_grid.enableDragAndDrop(true); option_grid.setImagePath("js/dhtmlxGrid/imgs/"); option_grid.setSkin("light"); option_grid.setHeader("c1,c2,c3"); option_grid.setInitWidths("*,50,100"); option_grid.setColAlign("left,left,right"); option_grid.setColTypes("tree,ed,ed"); option_grid.setColSorting("str,na,na"); option_grid.setColumnIds("asset_name,mci,emb_co2"); option_grid.init(); option_grid.loadXML("load_option.php?option_id="+option_id+"&rv="+rv); ... /* reload asset_grid list based on parent in option option_grid */ option_grid.attachEvent("onRowSelect", function(src_id) { var node_level = parseInt(option_grid.getLevel(src_id)); ... if(node_level == 1) { alert(node_level); asset_grid.setHeader("Applicable Process Groups"); }else if(node_level == 2) { alert(node_level); asset_grid.setHeader("Applicable Plant Groups"); }else if(node_level == 3) { alert(node_level); asset_grid.setHeader("Applicable Plant Group Models"); } }); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The alert are popping up showing the appropriate level and that it's getting to the right part of the code. However, the head of the asset_grid just wont change. Thanks in advance. Answer posted by Support on Dec 02, 2008 02:01 setHeader can be used to define grid header structure, it not suitable for dynamic change of header's labels You can change your code as if(node_level == 1) { alert(node_level); asset_grid.setColumnLabel(0,"Applicable Process Groups"); Answer posted by MHW on Dec 02, 2008 03:21 Thank you. That's perfect. |