Trying to regroup a preloaded dataTable
Trying to regroup a preloaded dataTable
Hello - I am trying to implement the rowGrouping plug-in for one of my JSF pages. The requirement is to do grouping on different columns (made available through a select box). I tried using fnDestroy() and fnClearTable(), before calling the rowGrouping and it doesn't work. Here is my js code :
$(document).ready(function() {
$('#displayWLTable').dataTable().rowGrouping({"bDestroy": true});
});
function callGroupByField(){
var selectedgroupByField = ($("#groupByField").val());
if (selectedgroupByField == 'contract'){
$('#displayWLTable').dataTable().fnClearTable();
$('#displayWLTable').dataTable().rowGrouping({
iGroupingColumnIndex: 3,
sGroupingColumnSortDirection: "asc"
});
}
}
my xhtml table code :
Due:
By default the display is grouped by the first column (Label). Now when I select, "Contract" in the select box, the display should get groupeded by Contract column. I am sure, I might be missing something trivial. Can you please help.
$(document).ready(function() {
$('#displayWLTable').dataTable().rowGrouping({"bDestroy": true});
});
function callGroupByField(){
var selectedgroupByField = ($("#groupByField").val());
if (selectedgroupByField == 'contract'){
$('#displayWLTable').dataTable().fnClearTable();
$('#displayWLTable').dataTable().rowGrouping({
iGroupingColumnIndex: 3,
sGroupingColumnSortDirection: "asc"
});
}
}
my xhtml table code :
Due:
By default the display is grouped by the first column (Label). Now when I select, "Contract" in the select box, the display should get groupeded by Contract column. I am sure, I might be missing something trivial. Can you please help.
This discussion has been closed.
Replies