为什么UI-Grid Selection抛出JS错误

时间:2019-02-06 00:45:04

标签: angular-ui-grid

代码中的ui-grid运行正常,突然开始抛出

  

未捕获的TypeError:row.setSelected不是函数       在Object.toggleRowSelection(ui-grid.js:247923)       在HTMLDivElement.selectCells(ui-grid.js:248324)       在HTMLDivElement.dispatch(jquery:1)       在HTMLDivElement.y.handle(jquery:1)

我正在如下注册gridApi

网格呈现良好,但是在选择任何行时,都会引发上述错误。

    $scope.uigParticipant = {
        enableRowSelection: false,
        multiSelect: true, 
        enableRowHeaderSelection: true,
        enableColumnMenus: false,
        enableFiltering: true,
        enableSorting : true,
        treeRowHeaderAlwaysVisible: false,
        enablePaginationControls: true,
        paginationPageSizes: [25, 50, 75, 100],
        paginationPageSize: 25,
        exporterMenuCsv: true,
        exporterMenuPdf: false,
        enableGridMenu: true,
        enableAutoFitColumns: true,
        showTreeExpandNoChildren: true,
        CanUserFreezeColumns: false,
        onRegisterApi: function (gridApi) {
            $scope.gridApi = gridApi;
            gridApi.selection.on.rowSelectionChanged($scope, function (rows) {
                $scope.mySelections = gridApi.selection.getSelectedRows();
            });
        },
        columnDefs: [


        { name: 'Id', displayName: 'ID', width: '25%', headerCellClass: $scope.highlightFilteredHeader, headerCellClass: 'grid-align-center', cellClass: 'grid-align-center' },
        { name: 'Name', displayName: 'Name', width: '25%', headerCellClass: $scope.highlightFilteredHeader },

        { name: 'DOB', displayName: 'Date of Birth', type: 'date', cellFilter: 'date:"dd/MM/yyyy"', width: '25%', headerCellClass: $scope.highlightFilteredHeader, headerCellClass: 'grid-align-center', cellClass: 'grid-align-center' },
            { name: 'PhoneNo', displayName: 'Phone', width: '25%', headerCellClass: $scope.highlightFilteredHeader, headerCellClass: 'grid-align-center', cellClass: 'grid-align-center' }
            //{ name: 'Program', displayName: 'Program', width: '20%', headerCellClass: $scope.highlightFilteredHeader, headerCellClass: 'grid-align-center', cellClass: 'grid-align-center' }
        //{ name: 'RegisteredDate', displayName: 'Registered Date', width: '20%', headerCellClass: $scope.highlightFilteredHeader },
        ]
    };

请提供一些想法。最近对ui-grid-selection进行了任何更改。 这开始在涉及ui-grid的所有应用程序中发生。

1 个答案:

答案 0 :(得分:0)

这似乎是4.7.x中的已知错误。参见https://github.com/angular-ui/ui-grid/issues/6928