Ahmad
Ahmad

Reputation: 25

Datatables - Search Box filter on specific column

i am using Datatables and i want to make the search box "filtration" applied on a specific columns like "name" and "email" , is it possible and how ?

thanks

Upvotes: 2

Views: 10702

Answers (2)

Shantaram Tupe
Shantaram Tupe

Reputation: 1666

use columnsDef OR columns options.
The code disabled search for the specified columns base on Column Index.

'columnDefs' : [     // see https://datatables.net/reference/option/columns.searchable
    { 
       'searchable'    : false, 
       'targets'       : [0,1,4] 
    },
]

"columns": [
    { "searchable": false },
    null,
    null,
    null,
    null
]

Go thro this link https://datatables.net/reference/option/columns.searchable

Upvotes: 4

Rik Lewis
Rik Lewis

Reputation: 749

Yes, use columns().search() instead of filter().

Click here for more details on datatables.net, including examples

Upvotes: 0

Related Questions