Using aaSortingFixed to fix a row in table, irregardless of column reorder or sorting
Using aaSortingFixed to fix a row in table, irregardless of column reorder or sorting
First off, I'm really excited to be using DataTables. When I get paid for this project, I'm definitely buying you a 12-pack of "beer."
I'm using DataTables for an admin reporting tool, so I've been making full use of plugins and customization. However, somewhere along the way, I ran into a script conflict and now basic sorting isn't working. When I remove the aaSortingFixed line, the table works again. I REALLY need that fixed, as it contains totals for all the columns, and I'm using the colReorder plugin, so adding it as a or an additional row isn't an option. As you'll see, I'm also using tooltips with the fnDrawCallback (there was an issue with pagination that wouldn't show the tooltips after the first page).
Can you look over the following code to see if there is indeed a conflict? (to note, I'm calling in the JQuery options with another parent function, hence the single quotes and formatting)
[code]
$('.overview-stats').dataTable({
'bLengthChange': true,
'bPaginate': true,
'sPaginationType': 'full_numbers',
'iDisplayLength': 15,
'bInfo': false,
'bRetrieve':true,
'bDestroy':true,
'bAutoWidth':false,
'sDom': 'RlCTfrtip',
'oLanguage': {'sSearch': 'Find:', 'oPaginate': { 'sNext': '>', 'sLast': '>>', 'sFirst': '<<', 'sPrevious': '<'}},
'aaSortingFixed': [[0,'asc']],
'bSort':true,
'fnDrawCallback':
function() {
$('#tooltip-sticky a').cluetip({cluetipClass: 'tools', width: '160px', hoverClass:'highlight', closePosition: 'title', closeText:'', local:true, activation: 'click', sticky: true, hideLocal: true, cursor: 'pointer'});
$('#tooltip-hover a').cluetip({width: '200px', showTitle:false, local:true, hideLocal: true, cursor: 'pointer'});
}
});
[/code]
I'm using DataTables for an admin reporting tool, so I've been making full use of plugins and customization. However, somewhere along the way, I ran into a script conflict and now basic sorting isn't working. When I remove the aaSortingFixed line, the table works again. I REALLY need that fixed, as it contains totals for all the columns, and I'm using the colReorder plugin, so adding it as a or an additional row isn't an option. As you'll see, I'm also using tooltips with the fnDrawCallback (there was an issue with pagination that wouldn't show the tooltips after the first page).
Can you look over the following code to see if there is indeed a conflict? (to note, I'm calling in the JQuery options with another parent function, hence the single quotes and formatting)
[code]
$('.overview-stats').dataTable({
'bLengthChange': true,
'bPaginate': true,
'sPaginationType': 'full_numbers',
'iDisplayLength': 15,
'bInfo': false,
'bRetrieve':true,
'bDestroy':true,
'bAutoWidth':false,
'sDom': 'RlCTfrtip',
'oLanguage': {'sSearch': 'Find:', 'oPaginate': { 'sNext': '>', 'sLast': '>>', 'sFirst': '<<', 'sPrevious': '<'}},
'aaSortingFixed': [[0,'asc']],
'bSort':true,
'fnDrawCallback':
function() {
$('#tooltip-sticky a').cluetip({cluetipClass: 'tools', width: '160px', hoverClass:'highlight', closePosition: 'title', closeText:'', local:true, activation: 'click', sticky: true, hideLocal: true, cursor: 'pointer'});
$('#tooltip-hover a').cluetip({width: '200px', showTitle:false, local:true, hideLocal: true, cursor: 'pointer'});
}
});
[/code]
This discussion has been closed.
Replies
I don't think I've actually tried aaFixedSorting with ColReorder, but it should work... I'll check shortly and get back to you. In the mean time, are you allowing the user the ability to move your sorting fixed column or not (the not can be done like this: http://datatables.net/release-datatables/extras/ColReorder/fixedcolumns.html ).
Regards,
Allan
I've just tried your code and aaSortingFixed seems to work okay for me - regardless of the position of the column with the fixed sorting, the fixed sorting will always apply.
Might you be able to link us to an example which isn't working please?
Regards,
Allan
I've gone through line by line in my code and narrowed it down to a sorting issue with the tooltips being called in.
The data is getting sorted by the entire string, including the and classes and ids I have in place. Is there a way to have DataTables only read the visible text?
- R
I used aoColumns and set the sType to HTML.