EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: swells808 on November 08, 2014, 08:34:23 AM



Title: Auto Sort not working
Post by: swells808 on November 08, 2014, 08:34:23 AM
Hello all. I was able to turn sorting on my columns so I can manually click on the headers to order things but I am having an issue making it happen manually. I am trying to set my grid so it sorts the shift column ascending then the date column after that.

My first try was to add the following code to the get users php file:
Code:
$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 20;
$sort = isset($_POST['sort']) ? strval($_POST['sort']) : 'shift';
$order = isset($_POST['order']) ? strval($_POST['order']) : 'asc';
$offset = ($page-1)*$rows;

Then I went into the html and added this:
Code:
<body bgcolor="#3d3d3d">
<table id="dg" title="Flight Assignment" class="easyui-datagrid" style="width:1000px;height:650px"
url="get_users.php"
toolbar="#toolbar"
data-options="
pagination:true,
pageSize:20,
rownumbers:true,
fitColumns:true,
singleSelect:true,
remoteSort:true,
multiSort:true,
                ">
<thead>
<tr>
<th data-options="field:'shift',width:50,sortable:true">SHIFT</th>
<th data-options="field:'date',width:80,sortable:true">DATE</th>
This allowed me a sheet that worked but, I had to manually sort. My next step was to add
Code:
sortName:shift,
sortOrder:asc,
in the data-options area but that broke the page. I even tried changing remoteSort:true but, that didn't help either. What am I missing? Thanks.


Title: Re: Auto Sort not working
Post by: jarry on November 08, 2014, 05:02:47 PM
The 'sortName' and 'sortOrder' properties must be string values.
Code:
sortName:'shift,date',
sortOrder:'asc,asc',


Title: Re: Auto Sort not working
Post by: swells808 on November 10, 2014, 12:54:08 PM
Thank you that moved it!