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 use sort () function and file fragments to realize the front-end sorting of tables

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the knowledge of "how to use the sort () function and file fragments to achieve the front-end sorting of tables". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Table sorting is also widely used on web pages, especially when some information systems output a dense table to people, customers will certainly put forward the request of table sorting. Many people think that the sorting of tables must be carried out through the database back-end interaction, using statements with order by asc/desc to achieve, and then using ajax seems perfect. In fact, you don't have to deal with databases at all. If any table is given at the front end, the front-end sorting of the table can be realized by using the sort () function and file fragments. There is a plug-in for advanceTable in jquery to do this, but what is quite bad about this plug-in? Like the usual plug-ins, the code is written in smallpox, without any comments, is not easy to change, and cannot be implemented in any table or browser. The following is a way to achieve this function by using the original ecology of Javascript compatible IE6, no plug-ins and no connection to the database.

I. basic objectives

There are the following tables on the web page. Click on any item in the header to sort, and then click to reverse the order.

II. HTML layout

This will not be a bad idea. If you have studied the web page, you know how to do the form. The only thing to note is that the implementation of hovering mouse hands means that you can just put a clip in front and back. You don't have to worry about the problem that clicking will jump. Without the href attribute, there will be no problem. Set an id to myTable for this table to make it easier to do things later.

Table sorting

User name

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