Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Phil on May 26, 2009 09:30
open dhtmlx forum
Retrieve grid column sorting data

Is it possible to retrieve the column sorting information on a grid? I don't see a getColSorting() function. I realize that I can get the serialized grid header by using setSerializationLevel() then serialize() but it is painful to change the serialization level and also parse the returned xml just to get the value of the "sort" attribute.

Alternatively, is it possible to explicitly retrieve the attributes on a header?

I'm using the Professional edition.

Thanks,

Phil.
Answer posted by Support on May 26, 2009 09:34
There is the next method
            grid.getSortingState();
returns the array, first element is index of sorted column, second - direction of sorting ("asc" or "des")

>> to explicitly retrieve the attributes on a header
You can get sorting state or text value of column, there is no any other accessible values can be retrieved from header. 
Answer posted by Phil on May 27, 2009 01:11
Thanks for the prompt reply.

Yes, I'm aware of grid.getSortingState() but this doesn't return the data I need; this only gives me the id and direction of the sorted column.

What I want to get is the sort information on each column in the grid. Suppose i have the following grid...

<rows>
<head>
<column width='73' align='center' type='ch' sort='na' color='' id='Column1'>Column 1</column>
<column width='98' align='' type='ro' sort='server' color='' id='Column2'>Column 2</column>
<column width='78' align='' type='ro' sort='server' color='' id='Column3'>Column 3</column>
<column width='98' align='' type='ro' sort='na' color='' id='Column4'>Column 4</column>
</head>
</rows>

...i want to be able to retrieve the value of the sort attribute on every column. If possible I want to do this without writing a function which serializes the headers and then parses each column for the sort attribute.
Answer posted by Phil on May 27, 2009 03:52
Thanks for the prompt reply.

Yes, I'm aware of grid.getSortingState() but this doesn't return the data I need; this only gives me the id and direction of the sorted column.

What I want to get is the sort information on each column in the grid. Suppose i have the following grid...

<rows>
<head>
<column width='73' align='center' type='ch' sort='na' color='' id='Column1'>Column 1</column>
<column width='98' align='' type='ro' sort='server' color='' id='Column2'>Column 2</column>
<column width='78' align='' type='ro' sort='server' color='' id='Column3'>Column 3</column>
<column width='98' align='' type='ro' sort='na' color='' id='Column4'>Column 4</column>
</head>
</rows>

...i want to be able to retrieve the value of the sort attribute on every column. If possible I want to do this without writing a function which serializes the headers and then parses each column for the sort attribute.
Answer posted by dhxSupport on May 27, 2009 04:40
Unfortunately there is not appropriate method which can allow you get type of the column sorting.