Gender filtering Male & Female

Gender filtering Male & Female

maskmemaskme Posts: 1Questions: 0Answers: 0
edited May 2013 in General
I'm using bottom Text box search using fnFilter, but when I want to search for Male, it displays Female also, since the word Male contains in Female also.

How can i fix this issue? I cannot find any document on this to resolve.

Replies

  • turbosigturbosig Posts: 1Questions: 0Answers: 0
    Here is what I did.

    Column Data:
    (Male)Male
    (Female)Female

    Then for the filter I used:
    { type: "select", values: ['(Male)', '(Female)'] }

    I had to use parentheses around the filters, but no one has complained so far. Most people just read it as Male/Female.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Use a regular expression in your filter: `table.fnFilter( '^Male', 1, true, false );` - to perform a regex filter on column 1. Another option is to disable the case-insenstivity of DataTables.

    Allan
This discussion has been closed.