Easyui: Easyui Datagrid sorting, easyuidatagrid

Source: Internet
Author: User

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>
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.