当前位置:网站首页>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.
边栏推荐
- Report on investment analysis and prospect trend prediction of China's MOCVD industry Ⓤ 2022 ~ 2028
- In depth research and investment strategy report on China's hydraulic parts industry (2022 Edition)
- Lauchpad X | 模式
- Analysis report on the production and marketing demand and investment forecast of tellurium dioxide in the world and China Ⓣ 2022 ~ 2027
- There are 100 people eating 100 apples, one adult eating 4 apples, and four children eating 1 apple. How can they eat exactly 100 apples? Use any high-level language you are familiar with
- How do microservices aggregate API documents? This wave of show~
- Dynamic analysis and development prospect prediction report of high purity manganese dioxide in the world and China Ⓡ 2022 ~ 2027
- Write a jison parser from scratch (6/10): parse, not define syntax
- C language - Introduction - Foundation - syntax - [main function, header file] (II)
- How to batch change file extensions in win10
猜你喜欢
Some points needing attention in PMP learning
Implementation principle of redis string and sorted set
QTreeView+自定义Model实现示例
2022-2028 global industry research and trend analysis report on anterior segment and fundus OTC detectors
Daughter love: frequency spectrum analysis of a piece of music
C語言-入門-基礎-語法-[運算符,類型轉換](六)
After unplugging the network cable, does the original TCP connection still exist?
el-table单选并隐藏全选框
26. Delete duplicates in the ordered array (fast and slow pointer de duplication)
LeetCode 74. Search 2D matrix
随机推荐
MySQL transaction mvcc principle
《网络是怎么样连接的》读书笔记 - FTTH
Flutter 小技巧之 ListView 和 PageView 的各種花式嵌套
165 webmaster online toolbox website source code / hare online tool system v2.2.7 Chinese version
Launpad | 基础知识
Langage C - démarrer - base - syntaxe - [opérateur, conversion de type] (vi)
MySQL foundation 02 - installing MySQL in non docker version
Opencv environment construction (I)
What is uid? What is auth? What is a verifier?
Basic data types in golang
2022-2028 global strain gauge pressure sensor industry research and trend analysis report
什么是uid?什么是Auth?什么是验证器?
Nurse level JDEC addition, deletion, modification and inspection exercise
Global and Chinese market of bipolar generators 2022-2028: Research Report on technology, participants, trends, market size and share
How should PMP learning ideas be realized?
"How to connect the network" reading notes - Web server request and response (4)
If you can quickly generate a dictionary from two lists
Latex download installation record
Development trend and market demand analysis report of high purity tin chloride in the world and China Ⓔ 2022 ~ 2027
The 14th five year plan and investment risk analysis report of China's hydrogen fluoride industry 2022 ~ 2028