当前位置:网站首页>In the case of easyUI DataGrid paging, click the small triangle icon in the header to reorder all the data in the database
In the case of easyUI DataGrid paging, click the small triangle icon in the header to reorder all the data in the database
2022-07-04 09:34:00 【Dandelion_ drq】
Explain :
When you click datagrid
When the small triangle icon of a column in the header ,easyui
It's sort of , But when we talk about datagrid
In the case of paging , Click Sort to sort the data on the current page , And the demand requires me to sort all the data in the database , In this case, you can only arrange the order from the background and then return .
Took a look at the documentation , It is found that clicking the small triangle icon will trigger onSortColumn
event , So we just need to ask the background again when this event is triggered datagrid
The data is ready .
Then go straight to the code ~~
var sortOrder = "asc"; // sort order ,asc: positive sequence ,desc: In reverse order
var sortField = "NickName"; // Name of the column to sort
// Initialize data list
function initDatagrid() {
$('#dg').datagrid({
url: '/api/Member',
method: "get",
striped: true,
border: true,
selectOnCheck: false,
checkOnSelect: false,
remoteSort: true, // Define whether to sort data from the server , To set up for true
singleSelect: false,
idField: 'MemberId',
pagination: true,
rownumbers: false,
pageSize: 20,
fitColumns: true,
columns: [[
...
]],
// Match the name of the column to be sorted with the positive order / These two parameters in reverse order are also transferred to the background for processing
onBeforeLoad: function (params) {
params.nickName = $("#nickName").val();
params.phone = $('#phone').val();
params.sortField = sortField;
params.sortOrder = sortOrder;
},
// The event triggered when clicking a column to sort
onSortColumn: function (sort, order) {
sortField = sort; // Name of the column to sort
sortOrder = order; // positive sequence or In reverse order
$('#dg').datagrid('reload');
}
});
}
But this is not perfect , stay easyui
In the original Click onSortColumn
Is to request a backstage , This point can be interrupted to test .
therefore , We need to block the original request , Otherwise, the background will be requested twice .
Specific measures , Is to modify jquery.easyui.js
/ jquery.easyui.min.js
file .
stay jquery.easyui.js
/ jquery.easyui.min.js
Search through the documents remoteSort
, Find the following code
if(opts.remoteSort){
_646(_63c);
}else{
_647(_63c,$(_63c).datagrid("getData"));
}
opts.onSortColumn.call(_63c,opts.sortName,opts.sortOrder);
};
hold if
Just comment out the code executed inside .( In the picture above is _646(_63c);
, It may be different ??).
PS:datagrid
and treegrid
There are remoteSort
This east east , Don't get me wrong !!
End.
边栏推荐
- Implementation principle of redis string and sorted set
- Launchpad x | mode
- 《网络是怎么样连接的》读书笔记 - WEB服务端请求和响应(四)
- Clion console output Chinese garbled code
- At the age of 30, I changed to Hongmeng with a high salary because I did these three things
- Tkinter Huarong Road 4x4 tutorial II
- How to ensure the uniqueness of ID in distributed environment
- 2022-2028 global probiotics industry research and trend analysis report
- 保姆级JDEC增删改查练习
- `Example of mask ` tool use
猜你喜欢
SSM online examination system source code, database using mysql, online examination system, fully functional, randomly generated question bank, supporting a variety of question types, students, teache
Some points needing attention in PMP learning
Function comparison between cs5261 and ag9310 demoboard test board | cost advantage of cs5261 replacing ange ag9310
C language - Introduction - Foundation - syntax - [main function, header file] (II)
How do microservices aggregate API documents? This wave of show~
How does idea withdraw code from remote push
GoLand environment variable configuration
Logstack configuration details -- elasticstack (elk) work notes 020
LeetCode 74. Search 2D matrix
Jianzhi offer 09 realizes queue with two stacks
随机推荐
"How to connect the network" reading notes - Web server request and response (4)
Global and Chinese market of planar waveguide optical splitter 2022-2028: Research Report on technology, participants, trends, market size and share
MySQL transaction mvcc principle
The child container margin top acts on the parent container
Analysis report on the production and marketing demand and investment forecast of tellurium dioxide in the world and China Ⓣ 2022 ~ 2027
Flutter 小技巧之 ListView 和 PageView 的各种花式嵌套
Global and Chinese market of sampler 2022-2028: Research Report on technology, participants, trends, market size and share
Opencv environment construction (I)
How should PMP learning ideas be realized?
At the age of 30, I changed to Hongmeng with a high salary because I did these three things
SSM online examination system source code, database using mysql, online examination system, fully functional, randomly generated question bank, supporting a variety of question types, students, teache
PHP is used to add, modify and delete movie information, which is divided into foreground management and background management. Foreground users can browse information and post messages, and backgroun
C語言-入門-基礎-語法-[運算符,類型轉換](六)
UML sequence diagram [easy to understand]
Markdown syntax
PHP student achievement management system, the database uses mysql, including source code and database SQL files, with the login management function of students and teachers
UML 时序图[通俗易懂]
Some points needing attention in PMP learning
Dynamic analysis and development prospect prediction report of high purity manganese dioxide in the world and China Ⓡ 2022 ~ 2027
20220701 Barbalat引理证明