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_aruruvamshi_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?

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    edited July 2017

    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?

  • vamshi_aruruvamshi_aruru Posts: 5Questions: 2Answers: 0

    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.

  • vamshi_aruruvamshi_aruru Posts: 5Questions: 2Answers: 0

    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?

This discussion has been closed.