1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
<?xml version="1.0" encoding="UTF-8" ?>
<dt-option group="callback">
<name>preDrawCallback</name>
<summary>Pre-draw callback.</summary>
<since>1.10</since>
<type type="function">
<signature>preDrawCallback( settings )</signature>
<parameter type="DataTables.Settings" name="settings">
DataTables settings object
</parameter>
<scope>HTML table element</scope>
</type>
<description>
The partner of the `dt-init drawCallback` callback, this function is called at the very start of each table draw. It can therefore be used to update or clean the display before each draw (for example removing events), and additionally can be used to cancel the draw by returning `false`. Any other return (including `undefined`) results in the full draw occurring.
</description>
<example title="Remove bound events from cells in the table's body"><![CDATA[
$('#example').dataTable( {
"preDrawCallback": function( settings ) {
$('#example tbody').off( 'click', 'td' );
}
} );
]]></example>
<example title="Cancel the table draw if #test has a value of 1"><![CDATA[
$('#example').dataTable( {
"preDrawCallback": function( settings ) {
if ( $('#test').val() == 1 ) {
return false;
}
}
} );
]]></example>
<related type="option">drawCallback</related>
</dt-option>
|