EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: korenanzo on April 28, 2016, 09:34:56 AM



Title: disable/enable sortable property of columns?
Post by: korenanzo on April 28, 2016, 09:34:56 AM
Hi,

I need to change the "sortable" property of a column;

I've tried with something like

o.datagrid('options').columns[0][n].sortable=false

it actually disables the action, but the header maintains the "data grid-sort-icon".

Is there a method to politely doing it?

thanks,

Ric


Title: Re: disable/enable sortable property of columns?
Post by: korenanzo on May 12, 2016, 08:21:29 AM
self reply, ForTheRecords :D

I've found the "sortable" is  a column property

so when I switch the mode (sortable=true/false) I must loop the columns data and change them
Code:
	var columns = $('#dg').datagrid('options').columns[0];
for (var i = 0; i < columns.length; i++) {
columns[i].sortable = sortMode;
}