How to keep a few rows out of search ?

How to keep a few rows out of search ?

jainankit0312jainankit0312 Posts: 22Questions: 1Answers: 0
edited June 2012 in General
Hi,

When using search, I want a few rows to remain visible even though they don't fulfill the search criteria.

How can I achieve this ?

I read about "$.fn.dataTableExt.afnFiltering" but couldn't get it completely.

Can someone share a piece of code or point me to a useful link.

Regards,
Ankit

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    [quote]I want a few rows to remain visible even though they don't fulfill the search criteria.[/quote]

    I don't understand, because how can I know (and - more importantly - how can DataTables know) which rows those are?

    P.S. You found this one as well? http://www.datatables.net/examples/plug-ins/range_filtering.html
  • jainankit0312jainankit0312 Posts: 22Questions: 1Answers: 0
    Hi koosvdkolk,

    Thanks for showing interest.

    When I add rows, I apply a different CSS to a few of them.

    While searching can I omit those particular rows from getting filtered. I can also provide the index of the rows, if required.

    The link you provided is not a global filter. I will be in need to define the filter for each column.

    Regards,
    Ankit
  • jainankit0312jainankit0312 Posts: 22Questions: 1Answers: 0
    Hi,

    When you use Row Grouping, the group title remains in the search if any row content matches with the filter criteria.

    How ?

    Regards,
    Ankit
  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    edited June 2012
    On http://datatables.net/plug-ins/api#fnFilterOnReturn it shows how you can change the 'search' input behavior. If you could let it call a different search function than the built-in, you would be able to apply your own extra 'rules'.

    An example of a different search function is: http://datatables.net/plug-ins/api#fnFindCellRowNodes. You could adapt this function, so it will look to the 'class' of the / being searched.
  • jainankit0312jainankit0312 Posts: 22Questions: 1Answers: 0
    Hi All,

    I got a way of keeping a few rows out of search.
    There is a function _fnFilter in the JS file. It basically returns a 'stack' which has the row index of rows those will be displayed after search.

    So, if you want a few rows to remain visible after search, just push the row index. oSettings.aiDisplay.push(rowIndex);

    Regards,
    Ankit Jain
This discussion has been closed.