EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rangaNadha on July 13, 2017, 02:08:21 AM



Title: reorderColumns removing existing datagrid filters
Post by: rangaNadha on July 13, 2017, 02:08:21 AM
Hi,

In the existing datagrid i have enabled filters, based on the new requirement i have used reorderColumns functionality.

After adding reorderColumns functionality, it is updating the columns but the existing filters disappear.

I have taken the reorderColumns extension from the below URL.
http://www.jeasyui.com/extension/columns_ext.php

I have taken the latest datagrid filter version from the below URL.
https://www.jeasyui.com/extension/datagrid_filter.php

Example:
Code:

var reorderColumns = function (){
var columnOrders = [one, two, three];

switch($("#type").val()){
case 'xyz' : columnOrders = [three, two, one];
break;
case 'xyz' : columnOrders = [two, three, one];
break;
default : columnOrders;
break;

}

table.datagrid('reorderColumns', columnOrders); // After this statement filters are disappearing
}


pageBody.on("click", "#dropdown" ,function() {
reorderColumns();
});


jquery.init() {
var table = $('#gridTable');
table.datagrid({
  pagination:true,
  remoteFilter:true,
  pageSize:10,
  remoteSort:true,
  loadMsg:"loading",
  url:"serviceCall.htm",
  onLoadError: function(){
  table.datagrid('loadData',[]);
},
view: main.noRecordsView
});

table.datagrid('enableFilter');

//For changing language based on locale
table.datagrid('getPager').pagination({
displayMsg: $("#paginationShowing").text() + " {from} "+ $("#paginationTo").text() + " {to} "+ $("#paginationOf").text() + " {total} "+ $("#paginationRecords").text(),
beforePageText : $("#paginationPage").text(),
afterPageText : $("#paginationOf").text() + " {pages}"
});
}



Title: Re: reorderColumns removing existing datagrid filters
Post by: Pierre on July 13, 2017, 02:20:42 AM
Please check this:
http://www.jeasyui.com/forum/index.php?topic=6342.0


Title: Re: reorderColumns removing existing datagrid filters
Post by: rangaNadha on July 13, 2017, 06:42:45 AM
In the above code i changed like below, now it is working fine.


Code:

table.datagrid('disableFilter');
table.datagrid('reorderColumns', columnOrders);
table.datagrid('enableFilter');

table.datagrid('getPager').pagination({
displayMsg: $("#paginationShowing").text() + " {from} "+ $("#paginationTo").text() + " {to} "+ $("#paginationOf").text() + " {total} "+ $("#paginationRecords").text(),
beforePageText : $("#paginationPage").text(),
afterPageText : $("#paginationOf").text() + " {pages}"
});


Thank you Pierre