mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-01 13:24:10 +01:00
New: search() and column[s]().search() API methods now have a 'get'
option - By passing in no parameters to the search API methods we can get the current search value - for example: $('#example').DataTable().search(); - This is to round of the API as the order() method already has a get option as to the paging information
This commit is contained in:
parent
ecd36146e9
commit
c916bb05fe
@ -1 +1 @@
|
||||
717db03423e7c0668edb47e8ad9e94be3706e139
|
||||
b857a20af8563c72e3b1acab0907ff3da7e89d1e
|
||||
|
20
media/js/jquery.dataTables.js
vendored
20
media/js/jquery.dataTables.js
vendored
@ -8028,6 +8028,16 @@
|
||||
|
||||
|
||||
_api_register( 'search()', function ( input, regex, smart, caseInsen ) {
|
||||
var ctx = this.context;
|
||||
|
||||
if ( input === undefined ) {
|
||||
// get
|
||||
return ctx.length !== 0 ?
|
||||
ctx[0].oPreviousSearch.sSearch :
|
||||
undefined;
|
||||
}
|
||||
|
||||
// set
|
||||
return this.iterator( 'table', function ( settings ) {
|
||||
if ( ! settings.oFeatures.bFilter ) {
|
||||
return;
|
||||
@ -8048,11 +8058,19 @@
|
||||
'column().search()'
|
||||
], function ( input, regex, smart, caseInsen ) {
|
||||
return this.iterator( 'column', function ( settings, column ) {
|
||||
var preSearch = settings.aoPreSearchCols;
|
||||
|
||||
if ( input === undefined ) {
|
||||
// get
|
||||
return preSearch[ column ].sSearch;
|
||||
}
|
||||
|
||||
// set
|
||||
if ( ! settings.oFeatures.bFilter ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.extend( settings.aoPreSearchCols[ column ], {
|
||||
$.extend( preSearch[ column ], {
|
||||
"sSearch": input+"",
|
||||
"bRegex": regex === null ? false : regex,
|
||||
"bSmart": smart === null ? true : smart,
|
||||
|
Loading…
Reference in New Issue
Block a user