mirror of
https://github.com/DataTables/DataTables.git
synced 2025-03-15 16:29:16 +01:00
Fixed: When destroying a table which had been filtered to no results, the 'No results' row was not automatically removed, returning in the table being unable to be re-initialised (since it has a colspan).
Fixed: Now use escape() and unescape() for state saving cookie with the filtering strings - 2608
This commit is contained in:
parent
8b4769f809
commit
fb20b17856
11
media/js/jquery.dataTables.js
vendored
11
media/js/jquery.dataTables.js
vendored
@ -2058,6 +2058,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If there is an 'empty' indicator row, remove it */
|
||||||
|
$('tbody>tr>td.'+oSettings.oClasses.sRowEmpty, oSettings.nTable).parent().remove();
|
||||||
|
|
||||||
/* When scrolling we had to break the table up - restore it */
|
/* When scrolling we had to break the table up - restore it */
|
||||||
if ( oSettings.nTable != oSettings.nTHead.parentNode )
|
if ( oSettings.nTable != oSettings.nTHead.parentNode )
|
||||||
{
|
{
|
||||||
@ -5733,7 +5736,7 @@
|
|||||||
sValue += '"iStart":'+ oSettings._iDisplayStart+',';
|
sValue += '"iStart":'+ oSettings._iDisplayStart+',';
|
||||||
sValue += '"iEnd":'+ oSettings._iDisplayEnd+',';
|
sValue += '"iEnd":'+ oSettings._iDisplayEnd+',';
|
||||||
sValue += '"iLength":'+ oSettings._iDisplayLength+',';
|
sValue += '"iLength":'+ oSettings._iDisplayLength+',';
|
||||||
sValue += '"sFilter":"'+ oSettings.oPreviousSearch.sSearch.replace('"','\\"')+'",';
|
sValue += '"sFilter":"'+ escape(oSettings.oPreviousSearch.sSearch)+'",';
|
||||||
sValue += '"sFilterEsc":'+ !oSettings.oPreviousSearch.bRegex+',';
|
sValue += '"sFilterEsc":'+ !oSettings.oPreviousSearch.bRegex+',';
|
||||||
|
|
||||||
sValue += '"aaSorting":[';
|
sValue += '"aaSorting":[';
|
||||||
@ -5747,7 +5750,7 @@
|
|||||||
sValue += '"aaSearchCols":[';
|
sValue += '"aaSearchCols":[';
|
||||||
for ( i=0 ; i<oSettings.aoPreSearchCols.length ; i++ )
|
for ( i=0 ; i<oSettings.aoPreSearchCols.length ; i++ )
|
||||||
{
|
{
|
||||||
sValue += '["'+oSettings.aoPreSearchCols[i].sSearch.replace('"','\\"')+
|
sValue += '["'+escape(oSettings.aoPreSearchCols[i].sSearch)+
|
||||||
'",'+!oSettings.aoPreSearchCols[i].bRegex+'],';
|
'",'+!oSettings.aoPreSearchCols[i].bRegex+'],';
|
||||||
}
|
}
|
||||||
sValue = sValue.substring(0, sValue.length-1);
|
sValue = sValue.substring(0, sValue.length-1);
|
||||||
@ -5802,7 +5805,7 @@
|
|||||||
oSettings.iInitDisplayStart = oData.iStart;
|
oSettings.iInitDisplayStart = oData.iStart;
|
||||||
oSettings._iDisplayEnd = oData.iEnd;
|
oSettings._iDisplayEnd = oData.iEnd;
|
||||||
oSettings._iDisplayLength = oData.iLength;
|
oSettings._iDisplayLength = oData.iLength;
|
||||||
oSettings.oPreviousSearch.sSearch = oData.sFilter;
|
oSettings.oPreviousSearch.sSearch = unescape(oData.sFilter);
|
||||||
oSettings.aaSorting = oData.aaSorting.slice();
|
oSettings.aaSorting = oData.aaSorting.slice();
|
||||||
oSettings.saved_aaSorting = oData.aaSorting.slice();
|
oSettings.saved_aaSorting = oData.aaSorting.slice();
|
||||||
|
|
||||||
@ -5822,7 +5825,7 @@
|
|||||||
for ( var i=0 ; i<oData.aaSearchCols.length ; i++ )
|
for ( var i=0 ; i<oData.aaSearchCols.length ; i++ )
|
||||||
{
|
{
|
||||||
oSettings.aoPreSearchCols[i] = {
|
oSettings.aoPreSearchCols[i] = {
|
||||||
"sSearch": oData.aaSearchCols[i][0],
|
"sSearch": unescape(oData.aaSearchCols[i][0]),
|
||||||
"bRegex": !oData.aaSearchCols[i][1]
|
"bRegex": !oData.aaSearchCols[i][1]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
40
media/unit_testing/tests_onhold/1_dom/2608.js
Executable file
40
media/unit_testing/tests_onhold/1_dom/2608.js
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
// DATA_TEMPLATE: dom_data
|
||||||
|
oTest.fnStart( "2608 - State saving escaping filters" );
|
||||||
|
|
||||||
|
$(document).ready( function () {
|
||||||
|
$('#example').dataTable( {
|
||||||
|
"bStateSave": true
|
||||||
|
} );
|
||||||
|
|
||||||
|
oTest.fnTest(
|
||||||
|
"Set the filter",
|
||||||
|
function () {
|
||||||
|
$('#example_filter input').val( '\\s*CVM\\s*$' );
|
||||||
|
$('#example_filter input').keyup();
|
||||||
|
},
|
||||||
|
function () { return $('#example_filter input').val() == '\\s*CVM\\s*$'; }
|
||||||
|
);
|
||||||
|
|
||||||
|
oTest.fnTest(
|
||||||
|
"Destroy the table and remake it - checking the filter was saved",
|
||||||
|
function () {
|
||||||
|
$('#example').dataTable( {
|
||||||
|
"bStateSave": true,
|
||||||
|
"bDestroy": true
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
function () { return $('#example_filter input').val() == '\\s*CVM\\s*$'; }
|
||||||
|
);
|
||||||
|
|
||||||
|
oTest.fnTest(
|
||||||
|
"Do it again without state saving and make sure filter is empty",
|
||||||
|
function () {
|
||||||
|
$('#example').dataTable( {
|
||||||
|
"bDestroy": true
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
function () { return $('#example_filter input').val() == ''; }
|
||||||
|
);
|
||||||
|
|
||||||
|
oTest.fnComplete();
|
||||||
|
} );
|
Loading…
x
Reference in New Issue
Block a user