Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Abdul Bari on May 27, 2009 06:34
open dhtmlx forum
setColumnHidden is not working


I am using bellow Code. my data is coming from Databae to JS Array and then to Grid. I want to hide the ID Column. More over i have got a save button when i click that so it gets all the fresh data from grid and sends it to server so if ID is hidden while getting it should still work.

or while clicking at it i should get the ID of it.

Could please please help me in this regard.

Thanks in advance for your support and co-operation.


function doInitGrid(){


mygrid = new dhtmlXGridObject('mygrid_container');

mygrid.setImagePath("codebase/imgs/");

mygrid.setHeader("ID,Name,Father Name,Province,Phone,DOB");
mygrid.attachHeader(",#text_filter,#text_filter,#select_filter,#numeric_filter,#numeric_filter");
mygrid.setInitWidths("50,150,150,100,100,100");
mygrid.setColAlign("left,left,left,left,right,right");
mygrid.setColTypes("ro,ed,txt,ro,ed,dhxCalendar");
mygrid.setSkin("light");

mygrid.setColSorting("int,str,str,str,int,date");
//mygrid.setDateFormat("%m/%d/%Y");
//mygrid.enableHeaderMenu();
mygrid.attachEvent("onRowDblClicked",doOnRowDblClicked);



mygrid.init();
mygrid.setColumnHidden(1);
//var ar = [[11,12,13],[21,22,23],[31,32,33]]

//arrMain='['+ arrMain + ']';
mygrid.parse(arrMain,"jsarray");
//mygrid.loadXML("step3.xml");
fillddlProvinceEdit();
hideDiv('dvProvince');

}
Answer posted by dhxSupport on May 27, 2009 09:11

setColumnHidden(ind, state) has parameters:

ind - column index. Column indexes begins from "0".
state - true/false - hide/show column. 

So in your case line shoud looks like that:
mygrid.setColumnHidden(0,true);


Answer posted by Abdul Bari on May 27, 2009 09:21

 

I tried

mygrid.setColumnHidden(0,true);

 

It does not hide the column, and also the Javascrip array data is also not shown now. i dont know whats the link of this line with data.

 

Answer posted by Alex (support) on May 27, 2009 09:33

Hello, 

setColumnHidden is available only in the PRO edition. Do you use grid PRO ?

If you use standard edition, you can set 0 width for the necessary column:

mygrid.setInitWidths("0,150,150,100,100,100");