This article is a mirror article of machine translation, please click here to jump to the original article.

View: 17550|Reply: 2

[Jquery] Added serial numbers for Datatables (1.10 new implementation)

[Copy link]
Posted on 11/14/2017 1:52:30 PM | | | |
JQuery's Datatables plugin is very good for making tables.

I thought it was easy to add a serial number to the table, but after reading the official implementation of Datatables, the code seems to be not simple, and the test found some problems, and it was not easy to use. I didn't find a good solution on the Internet, so I traced the code and found a way myself.

Serial number implementation (convenient, unofficial implementation)
Since column data can be a function, then look at the data in the parameters. It turned out that some useful data was indeed found and we started to get started.



The code is as follows:

The point is the following sentence
meta.settings._iDisplayStart + meta.row + 1;
After analysis, it is known that:
meta.settings._iDisplayStart The starting index of each record displayed;
meta.row+1 is the row index of the current page, plus 1 is the line number;
The sum of the two is the line serial number of the current period.

This method is not officially provided or recommended, but I think it is more intuitive and less expensive to handle the displayed data in data.





Previous:Los Angeles, USA_16 cores_96G memory _250M_550 yuan
Next:July 2017 WIN7\XP· GHOST System Download Encyclopedia! Updates continue, exciting!
Posted on 11/14/2017 2:44:37 PM |
                          
 Landlord| Posted on 3/8/2018 2:25:32 PM |
nametypedescription
drawintegerJSThe number of requests is countered, and it is returned as it is each time it is sent to the server.
startintegerJSThe starting position of the first piece of data, for example, 0 represents the first piece of data
lengthintegerJSNumber of items displayed per page.
search[value]stringJSGlobal search criteria for each column (searchable needs to be set to true)
search[regex]booleanJSIf true means that the value of the global search is processed as a regular expression, if false it is not.
order[column]integerJSi is an array index, corresponding to columns, starting from 0, and the subparameter indicates which column needs to be sorted
order[dir]stringJSThe column is determined above, and the sorting method of this column is descending asc
columns[data]stringJScolumnsbinding, defined by columns.data
columns[name]stringJScolumns.name
columns[searchable]booleanJSWhether a tagged column can be searched to true means yes, otherwise it can't, which is controlled by columns.searchable
columns[orderable]booleanJSWhether the tagged columns can be sorted to true means yes, otherwise no, this is controlled by columns.orderabl
columns[search] [value]stringJSSearch criteria for specific columns
columns[search] [regex]booleanJSWhether a search criteria for a particular column are considered regular expressions
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com