diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 10871b9b..2e9389e5 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -2627,17 +2627,17 @@ /* Check that the class assignment is correct for sorting */ if ( !oCol.bSortable || - ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1) ) + ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1) ) { oCol.sSortingClass = oSettings.oClasses.sSortableNone; oCol.sSortingClassJUI = ""; } else if ( oCol.bSortable || - ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1) ) - { - oCol.sSortingClass = oSettings.oClasses.sSortable; - oCol.sSortingClassJUI = oSettings.oClasses.sSortJUI; - } + ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1) ) + { + oCol.sSortingClass = oSettings.oClasses.sSortable; + oCol.sSortingClassJUI = oSettings.oClasses.sSortJUI; + } else if ( $.inArray('asc', oCol.asSorting) != -1 && $.inArray('desc', oCol.asSorting) == -1 ) { oCol.sSortingClass = oSettings.oClasses.sSortableAsc; @@ -2709,7 +2709,7 @@ { oCol.sType = sThisType; } - else if ( oCol.sType != sThisType ) + else if ( oCol.sType != sThisType && oCol.sType != "html" ) { /* String is always the 'fallback' option */ oCol.sType = 'string'; @@ -2913,7 +2913,8 @@ { oSettings.aoColumns[iColumn].sType = sThisType; } - else if ( oSettings.aoColumns[iColumn].sType != sThisType ) + else if ( oSettings.aoColumns[iColumn].sType != sThisType && + oSettings.aoColumns[iColumn].sType != "html" ) { /* String is always the 'fallback' option */ oSettings.aoColumns[iColumn].sType = 'string'; diff --git a/media/unit_testing/templates/html_table.php b/media/unit_testing/templates/html_table.php new file mode 100644 index 00000000..123f54b9 --- /dev/null +++ b/media/unit_testing/templates/html_table.php @@ -0,0 +1,66 @@ + + + + + + + DataTables unit testing + + + + + '."\n"; + } + ?> + + +
+
+ DataTables table with HTML elements template +
+ +

Live example

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
ReflectionLink
1DataTables
2A link to Integrity
3Integrity
4EIntegrity
+
+
+
+ + \ No newline at end of file diff --git a/media/unit_testing/tests_onhold/1_dom/html-autodetect-sort.js b/media/unit_testing/tests_onhold/1_dom/html-autodetect-sort.js new file mode 100755 index 00000000..c0f4ec50 --- /dev/null +++ b/media/unit_testing/tests_onhold/1_dom/html-autodetect-sort.js @@ -0,0 +1,57 @@ +// DATA_TEMPLATE: html_table +oTest.fnStart( "HTML auto detect" ); + +$(document).ready( function () { + var oTable = $('#example').dataTable(); + + oTest.fnTest( + "Initial sort", + null, + function () { + var ret = + $('#example tbody tr:eq(0) td:eq(0)').html() == '1' && + $('#example tbody tr:eq(1) td:eq(0)').html() == '2' && + $('#example tbody tr:eq(2) td:eq(0)').html() == '3'; + return ret; + } + ); + + oTest.fnTest( + "HTML sort", + function () { $('#example thead th:eq(1)').click() }, + function () { + var ret = + $('#example tbody tr:eq(0) td:eq(0)').html() == '2' && + $('#example tbody tr:eq(1) td:eq(0)').html() == '1' && + $('#example tbody tr:eq(2) td:eq(0)').html() == '4'; + return ret; + } + ); + + oTest.fnTest( + "HTML reverse sort", + function () { $('#example thead th:eq(1)').click() }, + function () { + var ret = + $('#example tbody tr:eq(0) td:eq(0)').html() == '3' && + $('#example tbody tr:eq(1) td:eq(0)').html() == '4' && + $('#example tbody tr:eq(2) td:eq(0)').html() == '1'; + return ret; + } + ); + + oTest.fnTest( + "Numeric sort", + function () { $('#example thead th:eq(0)').click() }, + function () { + var ret = + $('#example tbody tr:eq(0) td:eq(0)').html() == '1' && + $('#example tbody tr:eq(1) td:eq(0)').html() == '2' && + $('#example tbody tr:eq(2) td:eq(0)').html() == '3'; + return ret; + } + ); + + + oTest.fnComplete(); +} ); \ No newline at end of file