using grouping plugin, change sorting group via js ?
using grouping plugin, change sorting group via js ?
I have a page with datatable 1.9.4 incorporating the sorting plugin.
I would like the user to be able to change the sort column, but can't see any information on this.
With my limited jquery knowledge, the only way i have been able to do this is to create a php form and pass a post variable back to the page, (storing it as a variable $groupcolumn in this example),
This solution 'works', but I would love to be able to do this without reloading the page.
jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages = 3;
$(document).ready(function() {
$('#example').dataTable( {
"sPaginationType": "full_numbers",
//"bStateSave": true,
"bFilter": true,
"bAutoWidth": false,
"aaSorting": [[ 0, "desc" ]],//sort by name by default
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 3 ] },
{ "sWidth": "40px", "aTargets": [ 3 ] }
] } )
.rowGrouping({
iGroupingColumnIndex: <?php echo $groupcolumn; ?>,
sGroupingColumnSortDirection: 'desc',
sGroupBy: "Year",
bHideGroupingColumn: true,
bExpandableGrouping: true
});
} );
I would like the user to be able to change the sort column, but can't see any information on this.
With my limited jquery knowledge, the only way i have been able to do this is to create a php form and pass a post variable back to the page, (storing it as a variable $groupcolumn in this example),
This solution 'works', but I would love to be able to do this without reloading the page.
jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages = 3;
$(document).ready(function() {
$('#example').dataTable( {
"sPaginationType": "full_numbers",
//"bStateSave": true,
"bFilter": true,
"bAutoWidth": false,
"aaSorting": [[ 0, "desc" ]],//sort by name by default
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 3 ] },
{ "sWidth": "40px", "aTargets": [ 3 ] }
] } )
.rowGrouping({
iGroupingColumnIndex: <?php echo $groupcolumn; ?>,
sGroupingColumnSortDirection: 'desc',
sGroupBy: "Year",
bHideGroupingColumn: true,
bExpandableGrouping: true
});
} );
This discussion has been closed.