jQuery Custom Table (Original)

1 2 3 4 5 6 7 8 9 10 | var backupAataArray=[],// Receive API data to avoid sending multiple requests when switching pagesdataTotalNum=0,// Total number of recordstableNum=5,// Number of records displayed per pagefiltrateTable=[],// Data displayed in the table each time, limited by the number of records per page;pageNum=1,// Current page number;pageFixedNum=6,// Number of pages set during initializationdataSet=new Set();// Use a collection to store selected datavar roleSelect=[]// Role dropdown data;var pagesChoose=[1,2,3,5,10,20];// Customizable number of records displayed per pagevar setOn=true; |
Table Initialization Function S
1 | tableInit(jsonData,1,pagesChoose,false); |
Table Initialization Function E
* ID of the table to render. Very important. This is the key to rendering multiple tables (I'll encapsulate this into a reusable component next time. I suddenly realized there are many more things to consider.)
* jsonData: Data (Fixed data is used here because AJAX is not used due to local cross-origin issues. In an actual project, adjust this according to the real environment.)
* Number of records displayed per page. Default is 5. Accepted format: number. Set to true to use the default.
* Customizable number of records displayed per page. Default is [5,10,20]. Accepted format: array. Set to true to use the default.
* Whether to enable selection across pages. A Set is used here to avoid duplicate entries, so please use unique identifiers to distinguish records. true = enabled by default; false = disabled.