How to search only status 1 and 2 trough jquery?

How to search only status 1 and 2 trough jquery?

ChunxChunx Posts: 3Questions: 1Answers: 0

hello, i'm new learning datatables.
currently using serverside datatables.
I use ssp.class.php from github.
i'm migrating from basic table to datatables serverside. and I using datatables to make my searches and animations easier (without high load)

I tried searching for data with datatables via jquery.
and try to get the target column : 4, with status 1 and 2. how to implement it in jquery datatables?
if I use php mysql query. the query I use is status = 1 OR status = 2.

Here is my ajax:

{
    "draw": 0,
    "recordsTotal": 5994,
    "recordsFiltered": 5994,
    "data": [
        [
            "16",
            "admin",
            "client",
            "addr",
            "0"
        ],
        [
            "17",
            "james",
            "arthur",
            "sesame st.",
            "0"
        ],
        [
            "18",
            "john",
            "doe",
            "address 01",
            "1"
        ],
        [
            "19",
            "john",
            "blacks",
            "address 02",
            "1"
        ],
        [
            "20",
            "Jenny",
            "richie",
            "address st.",
            "2"
        ]
    ]
}

*i'm using individual column search
*and i'm sorry my english was so bad

This question has an accepted answers - jump to answer

Answers

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

    Hi @Chunx ,

    This example here should set you in the right direction - it's a simple server-side example, but matches your data structures.

    Cheers,

    Colin

  • ChunxChunx Posts: 3Questions: 1Answers: 0

    thank's @colin ,

    i'm using that guide already. but the problem is, i'm using individual column search. and i try to get people with status 1 and 2 on column target 4.
    is it possible to get it trough jquery? or should i edit this ssp.class.php

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

    Hi @Chunx ,

    If the search is a result of a search in the client, then those search conditions will be passed to the PHP script on the server side in the request - so it would be expected that the search be done there.

    Cheers,

    Colin

  • ChunxChunx Posts: 3Questions: 1Answers: 0

    i've just found this discussion.
    but, when i try to applied to my datatables the regex it doesn't work.
    i'm using this guide. can you help me @colin ?

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

    Hi @Chunx ,

    We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.