mirror of
https://github.com/DataTables/DataTables.git
synced 2024-11-28 10:24:10 +01:00
Update - example: Use initComplete for column filter example
This commit is contained in:
parent
f26ec6052f
commit
05414e1437
@ -1 +1 @@
|
||||
7a4382d11a7db5cae5e4b9311564c741b70c7dfd
|
||||
6bda0abd0cade0b2795f938b2a1d1686c3176024
|
||||
|
@ -32,20 +32,23 @@ $(document).ready(function() {
|
||||
} );
|
||||
|
||||
// DataTable
|
||||
var table = $('#example').DataTable();
|
||||
var table = $('#example').DataTable({
|
||||
initComplete: function () {
|
||||
// Apply the search
|
||||
this.api().columns().every( function () {
|
||||
var that = this;
|
||||
|
||||
// Apply the search
|
||||
table.columns().every( function () {
|
||||
var that = this;
|
||||
$( 'input', this.footer() ).on( 'keyup change clear', function () {
|
||||
if ( that.search() !== this.value ) {
|
||||
that
|
||||
.search( this.value )
|
||||
.draw();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}
|
||||
});
|
||||
|
||||
$( 'input', this.footer() ).on( 'keyup change clear', function () {
|
||||
if ( that.search() !== this.value ) {
|
||||
that
|
||||
.search( this.value )
|
||||
.draw();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
@ -66,7 +69,9 @@ $(document).ready(function() {
|
||||
<p>This examples shows text elements being used with the <a href="//datatables.net/reference/api/column().search()"><code class="api" title=
|
||||
"DataTables API method">column().search()</code></a> method to add input controls in the footer of the table for each column. Note that the
|
||||
<code>*index*:visible</code> option is used for the column selector to ensure that the <a href="//datatables.net/reference/api/column()"><code class="api" title=
|
||||
"DataTables API method">column()</code></a> method takes into account any hidden columns when selecting the column to act upon.</p>
|
||||
"DataTables API method">column()</code></a> method takes into account any hidden columns when selecting the column to act upon. <a href=
|
||||
"//datatables.net/reference/option/initComplete"><code class="option" title="DataTables initialisation option">initComplete</code></a> is used to allow for any
|
||||
asynchronous actions, such as Ajax loading of data or language information.</p>
|
||||
</div>
|
||||
<div class="demo-html"></div>
|
||||
<table id="example" class="display" style="width:100%">
|
||||
@ -566,20 +571,23 @@ $(document).ready(function() {
|
||||
} );
|
||||
|
||||
// DataTable
|
||||
var table = $('#example').DataTable();
|
||||
var table = $('#example').DataTable({
|
||||
initComplete: function () {
|
||||
// Apply the search
|
||||
this.api().columns().every( function () {
|
||||
var that = this;
|
||||
|
||||
// Apply the search
|
||||
table.columns().every( function () {
|
||||
var that = this;
|
||||
$( 'input', this.footer() ).on( 'keyup change clear', function () {
|
||||
if ( that.search() !== this.value ) {
|
||||
that
|
||||
.search( this.value )
|
||||
.draw();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}
|
||||
});
|
||||
|
||||
$( 'input', this.footer() ).on( 'keyup change clear', function () {
|
||||
if ( that.search() !== this.value ) {
|
||||
that
|
||||
.search( this.value )
|
||||
.draw();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} );</code>
|
||||
<p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
|
||||
<ul>
|
||||
|
Loading…
Reference in New Issue
Block a user