Filtering rows with multiple values?

Filtering rows with multiple values?

iFaithiFaith Posts: 2Questions: 0Answers: 0
edited April 2012 in General
Hi all,

I need an help about how to filter rows based on multiple input values. I have a table where i want to show only the rows which have one of my input values.

For instance, if i have a table like this:

ID | Value1 | Value2
1 | 5 | 6
2 | 3 | 1
3 | 0 | 9

And I want to show the rows which have ID equals to 1 and 2,

ID | Value1 | Value2
1 | 5 | 6
2 | 3 | 1

how can i do? Thanks.

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Use fnFilter with a regular expression: "1|2". For example:

    [code]
    t.fnFilter( "1|2", 0, true, false );
    [/code]

    Allan
  • iFaithiFaith Posts: 2Questions: 0Answers: 0
    ok it's quite perfect but the problem is, if I have a table like this

    ID | Value1 | Value2
    1 | 5 | 6
    2 | 3 | 1
    3 | 0 | 9
    14 | -1 | 7

    and I use fnFilter("1|2",0,true,false), the results is

    ID | Value1 | Value2
    1 | 5 | 6
    2 | 3 | 1
    14 | -1 | 7

    but I don't want the row with ID=14. How can I resolve this?
This discussion has been closed.