column hide/unhide and sort order

I’d like to know how I can capture 2 things… (1) a user hiding/unhiding event and identify the column name or index. (2) I’d also like to identify the sort column index and sort order. Can you please provide a sample in both the events and if possible, can I capture this information through the serialized xml.



I want to be able to identify the user’s preferred settings to reload them for the user’s next session.



this is what I have to identify column sorting… but how do I identify the sort order (asc, desc) ? ? ?

            grid.attachEvent(“onAfterSorting”, function(ind) {

                alert(ind);

            });



Thx in advance


>> a user hiding/unhiding event and identify the column name or index
I’m not pretty sure which action you have mean, the grid has not any special hiding related event



>>but how do I identify the sort order (asc, desc) ? ? ?
grid.attachEvent(“onAfterSorting”, function(ind,type,order) {
alert(“column “+ind+” was sorted as “+type+” in “+order+” order”);
});

By the way, grid support saving sorting state and some other states in cookie.
dhtmlx.com/docs/products/dhtmlxG … 9740897000



a user hiding/unhiding event and identify the column name or index
>>>>I’m not pretty sure which action you have mean, the grid has not any special hiding related event
When grid.enableHeaderMenu(); is used, right-clicking on the header menu allows you to hide/unhide columns.  I want to be able to identify the “visible” columns such that I can display ONLY the visible columns on user’s next session.  Perhaps an enhancement would be to include a “visible” attribute in the tag ?  Also, a “sortorder” attribute in the tag would be helpful as well.

thx for the onAfterSorting code snippet.

Starting from dhtmlxgrid 1.6 column@visible attribute can be used to define hidden columns from XML ( this parameter not included in serialization ) - the support of this feature is still experimental

>>When grid.enableHeaderMenu(); is used, right-clicking on the header menu allows you to hide/unhide columns.
Unfortunately there is no separate event to catch such action in current version.
The issue can be workarounded in two ways
a) adding custom event to exisitng code
b) using inner collection grid._hrrar , it is an array which contain flags for hidden columns (!!grid._hrrar[index]) - flag for column at “index”

I think I found another “work around.”  I find that the width is equal to zero if the column is hidden in the serialized xml.  Is this a safe assumption ?

Is this a safe assumption ?
The width of hidden column is always equal to 0, but if column resize enabled user can resize column to 0 as well.
There is a buitl in method to check the state of column
grid.isColumnHidden(index)