mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
Fixed: State saving when there were no column being sorted was broken - 2914
This commit is contained in:
parent
2315bf3635
commit
81107d0b7d
@ -14,7 +14,8 @@
|
|||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#example').dataTable( {
|
$('#example').dataTable( {
|
||||||
"bStateSave": true
|
"bStateSave": true,
|
||||||
|
"aaSorting": []
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
7
media/js/jquery.dataTables.js
vendored
7
media/js/jquery.dataTables.js
vendored
@ -5752,7 +5752,7 @@
|
|||||||
sValue += '"sFilter":"'+ encodeURIComponent(oSettings.oPreviousSearch.sSearch)+'",';
|
sValue += '"sFilter":"'+ encodeURIComponent(oSettings.oPreviousSearch.sSearch)+'",';
|
||||||
sValue += '"sFilterEsc":'+ !oSettings.oPreviousSearch.bRegex+',';
|
sValue += '"sFilterEsc":'+ !oSettings.oPreviousSearch.bRegex+',';
|
||||||
|
|
||||||
sValue += '"aaSorting":[';
|
sValue += '"aaSorting":[ ';
|
||||||
for ( i=0 ; i<oSettings.aaSorting.length ; i++ )
|
for ( i=0 ; i<oSettings.aaSorting.length ; i++ )
|
||||||
{
|
{
|
||||||
sValue += '['+oSettings.aaSorting[i][0]+',"'+oSettings.aaSorting[i][1]+'"],';
|
sValue += '['+oSettings.aaSorting[i][0]+',"'+oSettings.aaSorting[i][1]+'"],';
|
||||||
@ -5760,7 +5760,7 @@
|
|||||||
sValue = sValue.substring(0, sValue.length-1);
|
sValue = sValue.substring(0, sValue.length-1);
|
||||||
sValue += "],";
|
sValue += "],";
|
||||||
|
|
||||||
sValue += '"aaSearchCols":[';
|
sValue += '"aaSearchCols":[ ';
|
||||||
for ( i=0 ; i<oSettings.aoPreSearchCols.length ; i++ )
|
for ( i=0 ; i<oSettings.aoPreSearchCols.length ; i++ )
|
||||||
{
|
{
|
||||||
sValue += '["'+encodeURIComponent(oSettings.aoPreSearchCols[i].sSearch)+
|
sValue += '["'+encodeURIComponent(oSettings.aoPreSearchCols[i].sSearch)+
|
||||||
@ -5769,7 +5769,7 @@
|
|||||||
sValue = sValue.substring(0, sValue.length-1);
|
sValue = sValue.substring(0, sValue.length-1);
|
||||||
sValue += "],";
|
sValue += "],";
|
||||||
|
|
||||||
sValue += '"abVisCols":[';
|
sValue += '"abVisCols":[ ';
|
||||||
for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
|
for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
|
||||||
{
|
{
|
||||||
sValue += oSettings.aoColumns[i].bVisible+",";
|
sValue += oSettings.aoColumns[i].bVisible+",";
|
||||||
@ -5778,6 +5778,7 @@
|
|||||||
sValue += "]";
|
sValue += "]";
|
||||||
|
|
||||||
sValue += "}";
|
sValue += "}";
|
||||||
|
|
||||||
_fnCreateCookie( oSettings.sCookiePrefix+oSettings.sInstance, sValue,
|
_fnCreateCookie( oSettings.sCookiePrefix+oSettings.sInstance, sValue,
|
||||||
oSettings.iCookieDuration, oSettings.sCookiePrefix, oSettings.fnCookieCallback );
|
oSettings.iCookieDuration, oSettings.sCookiePrefix, oSettings.fnCookieCallback );
|
||||||
}
|
}
|
||||||
|
38
media/unit_testing/tests_onhold/1_dom/2914-state-save-sort.js
Executable file
38
media/unit_testing/tests_onhold/1_dom/2914-state-save-sort.js
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
// DATA_TEMPLATE: dom_data
|
||||||
|
oTest.fnStart( "2914 - State saving with an empty array" );
|
||||||
|
|
||||||
|
$(document).ready( function () {
|
||||||
|
document.cookie = "";
|
||||||
|
$('#example').dataTable( {
|
||||||
|
"bStateSave": true,
|
||||||
|
"aaSorting": []
|
||||||
|
} );
|
||||||
|
|
||||||
|
oTest.fnTest(
|
||||||
|
"No sort",
|
||||||
|
null,
|
||||||
|
function () { return $('#example tbody td:eq(3)').html() == "4"; }
|
||||||
|
);
|
||||||
|
|
||||||
|
oTest.fnTest(
|
||||||
|
"Next page",
|
||||||
|
function () {
|
||||||
|
$('#example').dataTable().fnPageChange( 'next' );
|
||||||
|
},
|
||||||
|
function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; }
|
||||||
|
);
|
||||||
|
|
||||||
|
oTest.fnTest(
|
||||||
|
"Destroy the table and remake it - checking we are still on the next page",
|
||||||
|
function () {
|
||||||
|
$('#example').dataTable( {
|
||||||
|
"bStateSave": true,
|
||||||
|
"aaSorting": [],
|
||||||
|
"bDestroy": true
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; }
|
||||||
|
);
|
||||||
|
|
||||||
|
oTest.fnComplete();
|
||||||
|
} );
|
Loading…
x
Reference in New Issue
Block a user