Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by udhaya on Apr 21, 2008 00:51
open dhtmlx forum
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




Answer posted by Support on Apr 21, 2008 01:52
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.
Answer posted on Apr 21, 2008 02:55

 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

Answer posted by Support on Apr 21, 2008 03:17
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);
    });