PDA

View Full Version : SortState property of GridColumn is coming as null for multilevel headers



webfriend13
1 Oct 2012, 1:27 AM
Hi all,

I am explicitly adding headerClick event to all columns in the grid. Upon header click, i read the sortState property of the grid to determine if column needs to be sorted in ASC order or DESc order. Following is the code.


for (var i = 1; i < grid.columns.length; i++) {
grid.columns[i].addListener('headerclick', onGridHeaderClick);
}

var onGridHeaderClick = function (ct, column, e, t, eOpts) {
if (column.sortState == "ASC") {
//Do something
}
else{
}
}




All this works fine when i have single level of headers. As soon as I have multiple level of header, sortState property comes as null and there is no way to determine whether we need to sort column in ASC order or DESC order. I want to know when I have multiple level of columns, how can i determine the sort order or sortState?

This is how the multi-level header looks and its JSON

39054




{
"Result": {
"Columns": [
{
"text": "",
"style": "text-align:center",
"width": 50,
"menuDisabled": true,
"dataIndex": "row0",
"align": "left"
},
{
"text": "UserName",
"style": "text-align:center",
"menuDisabled": true,
"dataIndex": "row1",
"width": 300,
"align": "left"
},
{
"text": "2012",
"columns": [
{
"text": "2012Q1",
"menuDisabled": true,
"style": "text-align:center",
"dataIndex": "[2012q1]",
"width": 120,
"tdCls": "",
"align": "right"
},
{
"text": "2012Q2",
"menuDisabled": true,
"style": "text-align:center",
"dataIndex": "[2012q2]",
"width": 120,
"tdCls": "",
"align": "right"
},
{
"text": "2012Q3",
"menuDisabled": true,
"style": "text-align:center",
"dataIndex": "[2012q3]",
"width": 120,
"tdCls": "",
"align": "right"
}
]
}
],
"Data": [
[
"1",
"TestUser",
"2,174,724,468",
"1,927,518,284",
"1,769,124,426"
]
]
}
}

mitchellsimoens
10 Oct 2012, 8:11 AM
So the sort state on the grouped column is null but is fine if the column within the group is fine?