EasyUI Forum

General Category => Bug Report => Topic started by: xarn on February 12, 2017, 02:45:42 PM



Title: remoteSort:false combined with a loadFilter is buggy
Post by: xarn 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.


Title: Re: remoteSort:false combined with a loadFilter is buggy
Post by: jarry on February 12, 2017, 03:21:09 PM
Please show an example to demonstrate your issue.


Title: Re: remoteSort:false combined with a loadFilter is buggy
Post by: xarn 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>