Easyui: Easyui Datagrid sorting, easyuidatagrid
Frontend configuration method
Method 1: Add in HTMLSortable: trueAttribute
<Th data-options = "field: 'amount _ OA ', width: 60, align: 'right', sortable: true"> total AMOUNT </th> |
Method 2: Add in JSSortable: trueAttribute
[{ Field: 'As _ CON_STATUS ', title: 'Contract status', width: 60, sortable: true },{ Field: 'wfnodename', title: 'audit status', width: 130, sortable: true },{ Field: 'Code _ CONTRACT ', title: 'Contract Code', width: 100, sortable: true },{ Field: 'tractname', title: 'Contract name', width: 100, sortable: true },{ Field: 'signamount ', title: 'Contract amount', width: 100, sortable: true }] |
Backend Receiving Method
$ Sort = $ _ REQUEST ['sort ']; $ Order = $ _ REQUEST ['order']; |
Here, sort indicates the sorting field, and order indicates the sorting method (asc, desc), for example:
Then, you can piece together the SQL statement based on the specific situation.
How does the front-end sort all the data when the jquery easyui datagrid is paged?
Easyui has already written a sorting statement. You only need to write the sorting field and it will automatically help you sort it. When you click the column name, it will help you sort it with this column, which is all data, not for the current page
How to Use the datagrid in jquery-easyui to display data
$ ('# RegList'). datagrid ({
Title: 'user management ',
IconCls: 'icon-OK ',
FitColumns: true,
Nowrap: false,
SingleSelect: true,
Rownumbers: true,
Animate: true,
Collapsible: true,
Pagination: true,
PageList: [5, 10, 15],
Url: '$ {ctx}/user! Data. action ',
IdField: 'regid ',
Columns :[[
{Field: 'userename', title: 'account', width: 150 },
{Field: 'usercname', title: 'name', width: 150 },
// {Field: 'usertype', title: 'user type', width: 150,
// Formatter: function (userType ){
// If (userType = '1 ')
// Return 'Organization users ';
// If (userType = '2 ')
// Return 'Member users ';
// If (userType = '3 ')
// Return 'prosecution users ';
// Return '--';
//}
//},
// {Field: 'usersex ', title: 'gender', width: 150,
// Formatter: function (userType ){
// If (userType = '0 ')
// Return 'male ';
// If (userType = '1 ')
// Return 'femal ';
// Return '--';
//}
//},
{Field: 'mobile', title: 'phone', width: 150}
],
Toolbar :[
{
... The remaining full text>