EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: A-K on October 31, 2014, 03:13:29 AM



Title: Geting sorted and order for all the columns
Post by: A-K on October 31, 2014, 03:13:29 AM
Hey, Is there a way I can get all the columns that are currently sorted and what order each of them is sorted('asc','desc')?

I mean if my table has 4 columns and the user sorted the first column to 'asc' and the third column to 'desc'
how can I get all this information? I need to save the state of the current columns with thier sort and order this is why I am asking.

Thanks!


Title: Re: Geting sorted and order for all the columns
Post by: stworthy on October 31, 2014, 06:21:12 AM
The 'sortName' and 'sortOrder' properties store all the sorting fields and their order.
Code:
var opts = $('#dg').datagrid('options');
console.log(opts.sortName);  // output 'f1,f3'
console.log(opts.sortOrder);  // output 'asc,desc'


Title: Re: Geting sorted and order for all the columns
Post by: A-K on October 31, 2014, 06:23:21 AM
Great! thanks.