Categories | Question details Back To List | ||||||||
serialize hidden column Hi, i want to serialize a grid. But it doesn't seem to store information about hidden columns. Is there any way to save this information? It's very important for us. Answer posted by dhxSupport on Jan 04, 2010 10:04 You can find out if column is hidden with isColumnHidden() method http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:api_method_dhtmlxgridobject_iscolumnhidden Answer posted by Micha Hastrich on Jan 04, 2010 22:50 Yes I know. The question is, if it is possible to save this information when calling serialize. Serialize doesn't seem to save this attribute. Or do we have to iterate over the grid, save hidden attributes in a List, manipulate the generated xml with this list (which isn't done quickly)? Answer posted by Micha Hastrich on Jan 04, 2010 23:19 I just found a workaround: mygrid1.loadXML("myjsp.jsp", hideColumns ); function hideColumns() { for (var i=0; i<mygrid1.getColumnsNum(); i++){ if (mygrid1.getColWidth(i) < 5) { mygrid1.setColumnHidden(i,true); } } } Answer posted on Jan 05, 2010 02:20 You can configure which column will be serialize with setSerializableColumns(list) where list - list of true/false values separated by comma, if list empty then all fields will be serialized http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:api_method_dhtmlxgridobject_setserializablecolumns Answer posted by Micha Hastrich on Jan 05, 2010 02:24 I want to serialize every column, but want to serialize the flag "hidden", too. Hidden columns may be marked as visible later, again. This information doesn't seem to be in the generated XML. Or am i doing something wrong? Answer posted by dhxSupport on Jan 05, 2010 03:25 There is no flag which can allow you serialize only hidden or not hidden columns. It some cases it useful to store additional data in hidden column but have ability to serialize this information. The only way to do not serialize hidden columns - iterate through all column, check if column hidden or not and configure serializable columns with setSerializableColumns() method. You can find example how setSerializableColumns method works here http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/17_serialization/02_pro_serialize_column.html Answer posted by Micha Hastrich on Jan 05, 2010 04:22 Sorry. I think my english isn't good enough. This is not what i mean. We have a Grid in which you can choose which column to display (hide/show via contextmenu on columnheaders). Now we want to store the whole grid in our database. The whole grid has many columns from which some columns are hidden and the others are not. We want to store them all (using serialize). We want to restore the exact copy of the earlier Grid. When we now use the serialized Grid (xml) to load the grid (loadXml) all columns are recovered (this is correct!). But the information which of the columns where hidden when the grid was serialized is gone. After loading all columns are back - but all are visible. Previous hidden columns have width <5, so i wrote this workaround above. Attachments (1)
Answer posted by Stanislav (support) on Jan 06, 2010 05:39 There is no way to add such functionality without changes in source code. If functionality is critical for your use-case, we can provide a patch which will add such ability. Answer posted on Jan 07, 2010 23:31 It would be nice if you could provide such a patch which includes "hidden" attributes in serialized DHTMLXGrid. |