EasyUI Forum
April 18, 2024, 10:34:39 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: remoteSort:false combined with a loadFilter is buggy  (Read 5925 times)
xarn
Newbie
*
Posts: 9


View Profile Email
« on: February 12, 2017, 02:45:42 PM »

Hi,

basically, client side sorting re-applies the loadFilter each time on the already transformed data (usually leading to exceptions or broken data). The workaround is pretty simple, since checking for a flag in the data is sufficient.
Perhaps fixing this bug would be relatively simple too ...perhaps.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: February 12, 2017, 03:21:09 PM »

Please show an example to demonstrate your issue.
Logged
xarn
Newbie
*
Posts: 9


View Profile Email
« Reply #2 on: February 12, 2017, 04:25:10 PM »

Here is a modified example of your multisort. As you can see, each sorting will provoke a doubling of the "unit cost".
It's quite an artificial example, since "loadFilter" is usually used to transom some data in easyui's format. However, re-calling it on each sort is simply a bug. Just wanna be helpful here.

Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Multiple Sorting - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Multiple Sorting</h2>
<p>Set 'multiSort' property to true to enable multiple column sorting.</p>
<div style="margin:20px 0;"></div>

<table id="dg">
<thead>
<tr>
<th data-options="field:'itemid',width:80,sortable:true">Item ID</th>
<th data-options="field:'productid',width:100,sortable:true">Product</th>
<th data-options="field:'listprice',width:80,align:'right',sortable:true">List Price</th>
<th data-options="field:'unitcost',width:80,align:'right',sortable:true">Unit Cost</th>
<th data-options="field:'attr1',width:250">Attribute</th>
<th data-options="field:'status',width:60,align:'center'">Status</th>
</tr>
</thead>
</table>
<script>
function twice(data) {
for(var i=0;i<data.rows.length;i++) {
data.rows[i]['unitcost'] *= 2;
}
return data;
}

$("#dg").datagrid({
url:'datagrid_data1.json',
method:'get',
loadFilter: twice,
remoteSort:false
});
</script>
</body>
</html>

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!