rowgrouping not working - no group

rowgrouping not working - no group

montoyammontoyam Posts: 568Questions: 136Answers: 5

I have a simple datatable that I am trying to add rowGrouping (WeekOfDate) to, but the first row says 'no group', but then the following rows are showing the data correctly. I searched the forum but not finding anybody talking about this 'no group' row message.

                <table id="WeeklyTotals" cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered">
                    <thead>
                        <tr>
                            <th>Week</th>
                            <th>Dept</th>
                            <th>Number</th>
                        </tr>
                    </thead>
                </table>
    $('#WeeklyTotals').DataTable({
        ajax: 'api/WeeklyTotals',
        columns: [
            { data: "EmployeeCounts.WeekOfDate" },
            { data: "Departments.DepartmentName" },
            { data: "EmployeeCounts.FT_Worksite" }
        ],
        order: [[0, 'asc']],
        rowGroup: {
            dataSrc: 0
        }
    });

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922
    Answer ✓

    You have:

        rowGroup: {
            dataSrc: 0
        }
    

    But you are using objects not arrays. You should use this:

        rowGroup: {
            dataSrc: "EmployeeCounts.WeekOfDate"
        }
    

    Kevin

  • montoyammontoyam Posts: 568Questions: 136Answers: 5

    that was it. perfect.

This discussion has been closed.