Searching a table which contain tinyint values?

Searching a table which contain tinyint values?

adamnetadamnet Posts: 6Questions: 5Answers: 0

Can I search table data rows which have tinyint values?
Scenario: A table contains people. A table column is for marital status. 0=not married, 1=married. Please note that the information is not in text format.
How can I search using datatable and fetch the married people or the opposite?
Any example?
Thank you

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 22,325Questions: 26Answers: 5,134
    Answer ✓

    I'm not clear on what exactly you have but I built this simple example:
    https://live.datatables.net/dudogodo/1/edit

    I created a search select list and a change event to execute the search. It uses column().search() to search the marital status column. Note that an empty string search clears the search term.

    The column uses columns.render to set the column display, search and filter values from the number 0 or 1 to Married or Not Married. See the orthogonal data docs for more details.

    If this doesn't help then please update my test case or provide a link to a test case that shows what you have so we can provide more specific suggestions.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Please provide more specifics of how you want the search to behave.

    Kevin

  • adamnetadamnet Posts: 6Questions: 5Answers: 0

    Hello Kevin

    Sorry for being late to answer, Thank you for your example! At the moment I am in the phase of planning rather coding, so I am trying to plan how things should operate, Another question I have is : Can I have two search controls in the same page? I.e. One will search for surnames and the other will search for the marital atstus. Is this possible? Is there any example?
    Thanks in advance.
    Panagiotis

  • kthorngrenkthorngren Posts: 22,325Questions: 26Answers: 5,134
    Answer ✓

    Can I have two search controls in the same page?

    Yes, there are lots of options. See this example and this example. The examples place the search elements in the footer but you can place them in the header or other location on the page similar to my example. Searching multiple columns are cumulative.

    Also take a look at the ColumnControl, SearchPanes and SearchBuilder for three different ready to use solutions.

    Kevin

Sign In or Register to comment.