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.
You can find out if column is hidden with isColumnHidden() method dhtmlx.com/dhxdocs/doku.php?id=d … lumnhidden
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)?
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);
}
}
}
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
dhtmlx.com/dhxdocs/doku.php?id=d … blecolumns
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?
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 dhtmlx.com/docs/products/dht … olumn.html
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.
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.
It would be nice if you could provide such a patch which includes “hidden” attributes in serialized DHTMLXGrid.