How to Populate koGrid Groups Array

我只是一个虾纸丫 提交于 2019-12-24 08:22:45

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/18124616/how-to-populate-kogrid-groups-array

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!