Filter to .select row

Filter to .select row

rick63rick63 Posts: 3Questions: 1Answers: 0

Hi,
for me i the first steps in this environment
Then i'm sorry for follow question but I don't find a resolution for me.

1) How can I hide the rows non selected with the use of the click button ?
2) How can back to see all rows ?

In attached you find a little example.
Thank you for feedback.

Bye
Riccardo.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949

    See this thread asking a similar question.

    Kevin

  • rick63rick63 Posts: 3Questions: 1Answers: 0

    Thank you Kevin,
    I saw the thread but don't clear how to applicate the hidden value on the row don't select.
    I wanted to loop over the table and hide the unselected rows.
    Then in the loop understand if the row is not selected and then hide it.

    Do you have any suggestions?

    Riccardo

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    You can't hide rows from the table, only remove them. The only way I can think of doing that is to have a hidden field in the table which you populate with select and depopulate with deselect, and when your button is pressed apply a column search with column().search() on that string. That should work, though not particularly elegant,

    Colin

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949
    Answer ✓

    Here is one option with the search plugin:
    http://live.datatables.net/nivenixu/1/edit

    It uses $.fn.dataTable.Api() to get an API instance as described here. It uses row().node() with the index parameter to get the tr of the row. Then uses jquery hasClass() to see if the row has the selected class. Displays the row if it does or filters out the row if it does not.

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Nice, that's better than my suggestion!

    Colin

  • rick63rick63 Posts: 3Questions: 1Answers: 0

    Great kthorngren!
    This is the solution I was looking for
    Thank you.

    Thank you also Colin for your answer.

    I wish you all a good continuation.

    Riccardo.

    Do you know how to close this discussion ?

Sign In or Register to comment.