Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the sorting problem of table data processed by table module in layui

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to solve the sorting problem of table module in layui after table data processing, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

In the process of using layui table, you will encounter a problem when you convert the data format of a column, or change the status of 0Unip 1 to yes / no, or change the number to star score display. My table data is converted to other forms, and sort:true is set up at the same time. At this time, after clicking the sort button, the column data disappears. How to solve the problem?

You only need to set the sort sort of a target table to resend the request to the server.

Table.on ('sort (here is the id of table)', function (obj) {/ / Note: tool is the name of the toolbar event, and test is the "corresponding value" of the attribute lay-filter= of the original table container / / although our table comes with sorting function, it does not request the server. / / sometimes, you may need to re-send the request to the server according to the currently sorted fields, so as to achieve server-side sorting, such as: table.reload ('here is the initial sorting of elem', {initSort: obj / / records when layui-table is defined. If it is not set, the sorting status of the header cannot be marked. Layui 2.1.1 New parameters, where: {/ / request parameters (Note: the parameters can be defined arbitrarily, not in the following fixed format) field: obj.field / / sort field, order: obj.type / / sort mode}});}) Thank you for reading this article carefully. I hope the article "how to solve the sorting problem of table data processed by table module in layui" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report