Update jQuery UI integration

- Fix error on span sorting class being applied to all span elements in
  the header cell
- Fix possible sort classes not working
pull/53/head
Allan Jardine 11 years ago
parent 019769d2d2
commit e942118178

@ -315,6 +315,19 @@ table.dataTable td {
height: 0; height: 0;
} }
@media screen and (max-width: 767px) {
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
float: none;
text-align: center;
}
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_paginate {
margin-top: 0.5em;
}
}
/* /*
* TableTools styling for jQuery UI * TableTools styling for jQuery UI
*/ */

@ -44,12 +44,28 @@ $.extend( DataTable.ext.classes, {
} ); } );
DataTable.ext.renderer.header.jqueryui = function ( settings, cell, column, classes ) { $.fn.DataTable.ext.renderer.header.jqueryui = function ( settings, cell, column, classes ) {
// Calculate what the unsorted class should be
var noSortAppliedClass = sort_prefix+'carat-2-n-s';
var asc = $.inArray('asc', column.asSorting) !== -1;
var desc = $.inArray('desc', column.asSorting) !== -1;
if ( !column.bSortable || (!asc && !desc) ) {
noSortAppliedClass = '';
}
else if ( asc && !desc ) {
noSortAppliedClass = sort_prefix+'carat-1-n';
}
else if ( !asc && desc ) {
noSortAppliedClass = sort_prefix+'carat-1-s';
}
// Setup the DOM structure
$('<div/>') $('<div/>')
.addClass( 'DataTables_sort_wrapper' ) .addClass( 'DataTables_sort_wrapper' )
.append( cell.contents() ) .append( cell.contents() )
.append( $('<span/>') .append( $('<span/>')
.addClass( classes.sSortIcon+' '+column.sSortingClassJUI ) .addClass( classes.sSortIcon+' '+noSortAppliedClass )
) )
.appendTo( cell ); .appendTo( cell );
@ -66,7 +82,7 @@ DataTable.ext.renderer.header.jqueryui = function ( settings, cell, column, clas
); );
cell cell
.find( 'span' ) .find( 'span.'+classes.sSortIcon )
.removeClass( .removeClass(
sort_prefix+'triangle-1-n' +" "+ sort_prefix+'triangle-1-n' +" "+
sort_prefix+'triangle-1-s' +" "+ sort_prefix+'triangle-1-s' +" "+
@ -77,7 +93,7 @@ DataTable.ext.renderer.header.jqueryui = function ( settings, cell, column, clas
.addClass( columns[ colIdx ] == 'asc' ? .addClass( columns[ colIdx ] == 'asc' ?
sort_prefix+'triangle-1-n' : columns[ colIdx ] == 'desc' ? sort_prefix+'triangle-1-n' : columns[ colIdx ] == 'desc' ?
sort_prefix+'triangle-1-s' : sort_prefix+'triangle-1-s' :
column.sSortingClassJUI noSortAppliedClass
); );
} ); } );
}; };

@ -406,6 +406,24 @@ table.dataTable td {
} }
// Collapse the two column display of the control elements when the screen is
// small
@media screen and (max-width: 767px) {
.dataTables_wrapper {
.dataTables_length,
.dataTables_filter,
.dataTables_info,
.dataTables_paginate {
float: none;
text-align: center;
}
.dataTables_filter,
.dataTables_paginate {
margin-top: 0.5em;
}
}
}

Loading…
Cancel
Save