Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82961

Using searchCols for server-side processing on 1.10

$
0
0

I've spent time recently familiarizing myself with Datatables, found the server-side approach perfect for our large results sets. But something I can't seem to trigger is searching / filtering on ONE column for the results set. The option searchCols<span>DT</span> looks perfect, but I can't seem to have it push values to columns[1][search][value], the column I'd like to search on.

Example code for searchCols<span>DT</span>:

$('#example').dataTable( {
"searchCols": [
null,
{ "search": "My filter" },
null,
{ "search": "^[0-9]", "escapeRegex": false }
]
} );

My code, thinking this array provided in searchCols<span>DT</span> would search the 2nd column:

$(document).ready(function(){           
$('#example').DataTable( {
"serverSide": true,
"ajax": 'http://hostname-here/cgi-bin/php_simple.php',
"searchCols":[
null,
{ "search" : "smalluser" }
]
} );
});

Any suggestions? Am I missing something simple? I spent considerable time wrapping my head around the changes between 1.9 - 1.10, and decided to embrace the 1.10 as I hope to use this moving forward with my project. If I change the GET parameter "columns[1][search][value]=smalluser" manually, it behaves as expected; what am I missing about using searchCols<span>DT</span> as a parameter in launch?

Many thanks.


Viewing all articles
Browse latest Browse all 82961

Latest Images

Trending Articles



Latest Images