Auto-Expanding multiple groups

Auto-Expanding multiple groups

codemonkey65codemonkey65 Posts: 14Questions: 3Answers: 0
edited October 2012 in DataTables 1.8
I have a datatable that has a dynamically created group name. Each group is a week number from 1 to 52 potentially. I will never show all 52 weeks of data but there will be times when many weeks need to be seen. My problem is the bExpandableGrouping property. In order for this to work with all groups, pagination must be turned off, so this method will not work for me. The solution is to set asExpandedGroups: ["WEEK: 1", "WEEK: 2", "WEEK: 3", etc.] I would prefer not to have to hard code all of my group names if it can be avoided. Is there another solution I can use to show all groups without turning of pagination?

My table definition is as follows:

var table = $('#grdLoadingData').dataTable({
"bLengthChange": false,
"bPaginate": true,
"sPaginationType": "full_numbers",
"aaData": records,
"sDom": "T<'clear'>lfrtip",
"oTableTools": {
"sRowSelect": "multi",
"sSwfPath": "../../scripts/jquery/media/swf/copy_csv_xls_pdf.swf",
"aButtons": ["print"]
"bAutoWidth": false,
"sScrollY": 600, //height
"bScrollCollapse": true,
"aoColumns": [
{ "sTitle": "MC #", "sWidth": "40px" },
{ "sTitle": "Order #", "sWidth": "40px" },
{ "sTitle": "Site", "sWidth": "25px" },
{ "sTitle": "Seq. #", "sWidth": "15px" },
{ "sTitle": "GroupingValue", "sWidth": "0px" }
bExpandableGrouping: true,
asExpandedGroups: ["INSIDE LOAD COMPLETE", "INSIDE LOAD INCOMPLETE", "WEEK: 1", "WEEK: 39", "WEEK: 40"],
iGroupingColumnIndex: 53


  • DaveGYNWADaveGYNWA Posts: 10Questions: 0Answers: 0
    Could you calculate the names of the weeks which need to be shown, then use the results to populate an array and apply that as the value of asExpandedGroups?
  • codemonkey65codemonkey65 Posts: 14Questions: 3Answers: 0
    My apologies for not responding sooner...I was able to create the array as you suggested, after creating the grouping value server side.

    Thanks for your help.
This discussion has been closed.