1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-19 17:54:14 +01:00

Dev fix: DataTables/DataTables #250

- Need to namespace custom DataTables events in 1.10
This commit is contained in:
Allan Jardine 2013-11-25 09:23:35 +00:00
parent 4549646891
commit 667ee39fdb
2 changed files with 16 additions and 9 deletions

View File

@ -1 +1 @@
7d8d52c60c66a7a672833810278db0d19ebd3ad9
ede390881112840a62002ab284e63c1a2e09a6fa

View File

@ -26,9 +26,9 @@ $(document).ready(function() {
}
$('#example')
.on( 'order', function () { eventFired( 'order' ); } )
.on( 'search', function () { eventFired( 'Filter' ); } )
.on( 'page', function () { eventFired( 'Page' ); } )
.on( 'order.dt', function () { eventFired( 'Order' ); } )
.on( 'search.dt', function () { eventFired( 'Search' ); } )
.on( 'page.dt', function () { eventFired( 'Page' ); } )
.dataTable();
} );
@ -42,8 +42,15 @@ $(document).ready(function() {
<h1>DataTables example <span>- DataTables events</span></h1>
<div class="info">
<p>DataTables fires a number of custom events which you can bind to in the standard jQuery fashion,
allowing your code to perform custom actions when these events occur.</p>
<p>DataTables fires a number of custom events which you can bind to in the standard jQuery fashion
(although note that the namespace <code>dt</code> <em>must</em> be used), allowing your code to perform
custom actions when these events occur.</p>
<p>All custom events fired by DataTables are fired with the namespace <code>dt</code> in order to
prevent conflicts arising with other jQuery plug-ins which also fire events. The DataTables <a href=
"//datatables.net/api/on%28%29"><code class="api" title="API method">on()</code></a> method can be used
like the jQuery <code>on()</code> method, but will automatically append the <code>dt</code> namespace
if required.</p>
<p>This example shows the use of the <a href="//datatables.net/event/sort"><code class="event" title=
"Event">sort</code></a>, <a href="//datatables.net/event/search"><code class="event" title=
@ -556,9 +563,9 @@ $(document).ready(function() {
}
$('#example')
.on( 'order', function () { eventFired( 'order' ); } )
.on( 'search', function () { eventFired( 'Filter' ); } )
.on( 'page', function () { eventFired( 'Page' ); } )
.on( 'order.dt', function () { eventFired( 'Order' ); } )
.on( 'search.dt', function () { eventFired( 'Search' ); } )
.on( 'page.dt', function () { eventFired( 'Page' ); } )
.dataTable();
} );
</pre>