Include the record count in the Pagaination selector (row /page control)
Include the record count in the Pagaination selector (row /page control)
justSteve
Posts: 49Questions: 8Answers: 1
Out of the box the table header includes a caption that displays 'showing x of y'. and another caption mixed with dropdown as:
Show [dropdown for records per page] entries.
I'm sure someone's already merged these two captions down to:
Show [dropdown for records per page] of y entries.
and also sure there was some amount of pain on the way. Either pain or mastery of the API?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The only thing I can really thing of, uses the
language.lengthMenu
setting and provides the row count by just using a standard CSS selector on the table rowsExample
I cant think of a way to get the number of rows in the table from the DT API, as the DT instance hasnt been initiated yet, and the
language.lengthMenu
doesn't take a closure as a value (so you cant do something fancy like use the API within the closure). So the method I showed is the only way I know, but its possible that im wrongThanks much -- and in implementing I realize I hadn't accounted for display of the page offset. It looks as though something can be gained by
page().info()
but not sure if values would be populated at that point. Should I be looking to jquery to just re-write the contents of theordersTable_length
div after the grid is rendered?Hi,
I'm sure someone probably has done this, but I'm not aware of any published code for it. A custom feature plug-in would probably be the best way to do it.
That would certainly be another option.
Allan