How to Populate koGrid Groups Array

563 views Asked by At

I have a koGrid configured as follows:

        var myItemsGrid = {
            data: myItems,
            columnDefs: [
                { field: 'item.title', displayName: 'Title', cellTemplate: $("#cdfUrlCellTemplate").html() },
                { field: 'item.dueTimeUtc', displayName: 'Due', cellFormatter: formatDate, sortFn: sortDates },
                { field: 'id', displayName: 'Edit', cellTemplate: $("#editCellTemplate").html() }
            ],
            showGroupPanel: true,
            groups: ['item.title'],
            showFilter: false,
            canSelectRows: false

        };

My problem is that the groups array, which I have tried to populate using the field name of one of the fields in my grid, causes the following error:

TypeError: Cannot read property 'isAggCol' of undefined

How should I be populating the groups array so that I can set up initial grouping for my grid?

2

There are 2 answers

2
daveywc On BEST ANSWER

I ended up having to patch the koGrid script to get the initial grouping of columns to work.

If anyone else has the problem I'm happy to provide the patched script. I will look at making a pull request to get the fix into the koGrid repository after putting it through its paces a bit more.

0
user2788402 On

I had the same problem and took a different approach by sending an event to the grid control to group by the first heading. Something like this:

jQuery("#symbolPickerView").find(".kgGroupIcon").first().click();

This works until there is some sort of patch generally available.