Home >Web Front-end >JS Tutorial >jquery implements table paging and sorting
This time I will bring you jquery to implement table paging and sorting. What are the precautions for jquery to implement table paging and sorting? . The following is a practical case, let's take a look.
Use the jQuery extension to implement table paging and sorting. When using this extension, you must add the header ae20bdd317918ca68efdc799512a9b39 and 92cee25da80fac49f6fb6eec5fd2c22a tags, because I use 92cee25da80fac49f6fb6eec5fd2c22a to perform paging. If thead is not added, the table header will also be used as a row in paging calculation.
<script language=" javascript " type="text/javascript"> $("#myTable").tablePaging({ pageSize: 5, sorting: true, sortSelector: ".js-Order", sortType: "number" }); </script>
If you only use the paging function: $("#myTable").tablePaging();
Parameter description:
id: jQuery(this).attr('id'), // 要分页的表格的ID pageSize: 10, // 单个页面显示记录数,默认是10条 sorting: false,//是否要进行排序,默认不排序 sort Direction : 'asc', //排序顺序,默认升序 sortSelector: '',//排序选择的列,这里需要给td设置一个class用来识别。可以从示例中看到演示 sortType: '', //排序支持的数字类型,‘number',‘string',‘date' onPaged: null // 排完序之后绑定事件
Look at the paging Effect:
# I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
jquery and js directly call the elements in the iframe parent-child window (with code)
How jQuery calculates iframe window width and height
jquery operation multi-function table
The above is the detailed content of jquery implements table paging and sorting. For more information, please follow other related articles on the PHP Chinese website!