How to show a few rows above and below the row that corresponds to the search?
How to show a few rows above and below the row that corresponds to the search?
vamshi_aruru
Posts: 5Questions: 2Answers: 0
Hi!
When we search for something in Datatables, only the table rows matching the searched word/phrase are displayed. Is it possible to display a few rows that are present before and a few rows that are present after it too?
Essentially, say I have a table
| some|
| data |
| is |
| here |
When I search for 'is', I only get the 'is' row. Is it possible to also display "data" and "here" rows too?
This discussion has been closed.
Answers
What behaviour would you expect when more than one row is found by the search?
Also, what would you do about any applied sort sequence?
I am disabling sorting on the columns, so that won't be a problem. I was kind of expecting similar search feature as when pressed ctrl+f for searches that match more than one row.
I am thinking this plugin will solve my problem.
https://datatables.net/plug-ins/api/page.jumpToData()
But is there also a way I can scroll to the specific row after going to the page?