column hide in XML

how to hide a column in XML itself…

I have 43 columns and the column Ids are different



I am setting the Column Id and Type in the XMl itself

I am setting the setcolumnHidden(1,true) it show error message



the error Message is



this.hdr.rows.1._childlndexes is null or not an object









Which version of dhtmlxgrid you are using ?
In dhtmlxgrid 1.5 the setColumnHidden can be safely executed from XML ( in case of using afterInit section )

>>the error Message is
Such error message will appear if you are executing setColumnHidden before grid structure initialized.
In case of init from XML please be sure that setColumnHidden command called only after xml was loaded - for such purpose you can use onXLE event or second parameter of loadXML command.


 mygrid = new dhtmlXGridObject(‘gridbox’);
 mygrid.enableAlterCss(“even”,“uneven”);



 mygrid.setOnKeyPressed(onKeyPressed);



 mygrid.enableMultiselect(true);
   mygrid.init();
   mygrid.loadXML(“sms/update.jsp?action=get_data”);
   mygrid.enableUndoRedo();



 mygrid.setColumnHidden(2,true);



 



I am placing the Column Hidden in the Grid.  But it the same error message…



 



Thanks and Regards



Udhayabalachandar.C

In your sample code configuration loaded from XML, so real grid initialization will occur only after XML loading.
Because XML loading is async, you need to catch moment when data loaded.
Most simple way:

   mygrid.loadXML(“sms/update.jsp?action=get_data”,function(){
        mygrid.setColumnHidden(2,true);
    });