Skip to content

Selection checkbox in ui-grid auto selecting on scrolling angularjs #7083

Open
@piyush21upadhyay

Description

@piyush21upadhyay

ui-grid checkboxes which are used to select a row automatically gets checked on scrolling. On scrolling fast up&down some checkboxes auto getting select even though row is not selected.

ui-grid version used is 4.6.2

Below is the grid-options of grid:

vm.gridOptions = {
    enableSorting: false,
    infiniteScrollRowsFromEnd: 40,
    infiniteScrollUp: false,
    infiniteScrollDown: true,
    enableRowSelection: true,
    enableSelectAll: true,
    multiSelect: true,
    enableColumnMenus: false,
    enableFullRowSelection: false,
    enableSelectionBatchEvent: false,
    enableRowHeaderSelection: true,
    enableCellEditOnFocus: true,
    treeRowHeaderAlwaysVisible: false,
    treeIndent: 20,
    showTreeExpandNoChildren: true,
    showTreeRowHeader: false,
    enableColumnResizing: true,
    //selectionRowHeaderWidth: 35,
    rowHeight: 40,
    enableHorizontalScrollbar: uiGridConstants.scrollbars.WHEN_NEEDED,
    columnDefs: [
      { name:'id'},
      { name:'name' },
      { name:'age' }
    ],
    data: 'data',
    onRegisterApi: function(gridApi){
      gridApi.infiniteScroll.on.needLoadMoreData($scope, getDataDown);
      //gridApi.infiniteScroll.on.needLoadMoreDataTop($scope, getDataUp);
      vm.gridApi = gridApi;

      gridApi.selection.on.rowSelectionChanged($scope, function() {
        // Here performing some logic to enable/disable some actions based on selection count
      });
    }
  };

Grid.html

<div ui-grid="$ctrl.gridOptions" class="grid"
    ui-grid-infinite-scroll
    ui-grid-resize-columns
    ui-grid-auto-resize
    ui-grid-selection
    ui-grid-edit 
    ui-grid-exporter
    ui-grid-row-edit
    ui-grid-cellNav 
    ui-grid-save-state></div>

uzT3E

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions