Enterprise: Datagrid: When Groupable is set on the datagrid, calls to rowStatus, addRow and removeRow do not work

Created on 26 Mar 2019  路  5Comments  路  Source: infor-design/enterprise

Describe the bug
I have a Datagrid with groupable setting set to group on one column. The data in the datagrid is grouped properly, but I cannot call methods relating to rows on the datagrid.

. The dataset on the grid looks like this:

  1. 0: {GroupName: "Search", values: Array(11)}
  2. 1: {GroupName: "Search Results", values: Array(13)}
  3. 2: {GroupName: "Trace Object Description", values: Array(9)}
  4. length: 3
  5. __proto__: Array(0)

So, if I am trying to change the status of a row, or add or delete a row and I pass in an index it doesn鈥檛 work because the dataset is an array of the groups, not an array of all the rows, so I get errors when trying to set the row status (below) or it just simply doesn't add or remove the row requested.
zone.js:199 Uncaught TypeError: Cannot convert undefined or null to object at Datagrid.rowStatus (sohoxi.js:70258) at ids-enterprise-ng.js:8738 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:150) at NgZone.push../node_modules/@angular/core/fesm5/core.js.NgZone.runOutsideAngular (core.js:3779) at SohoDataGridComponent.push../node_modules/ids-enterprise-ng/fesm5/ids-enterprise-ng.js.SohoDataGridComponent.rowStatus (ids-enterprise-ng.js:8737) at AdminPanelSettingsComponent.push../src/app/admin/admin.panelsettings.component.ts.AdminPanelSettingsComponent.resetRowStatus (admin.panelsettings.component.ts:364) at AdminPanelSettingsComponent.push../src/app/admin/admin.panelsettings.component.ts.AdminPanelSettingsComponent.doClick (admin.panelsettings.component.ts:231) at Object.tClickEdit [as click] (admin.panelsettings.component.ts:153) at HTMLTableCellElement.<anonymous> (sohoxi.js:68803)

Expected behavior
The row should be added or removed; the status on the row should be able to be set.

Version
4.12

Platform

  • OS Version: Windows 10
  • Browser Name: Chrome
  • Browser Version: 73.0.3683.86 (Official Build) (64-bit)
[5] datagrid high type

All 5 comments

@slsheridan can you attach all the settings your using in the grid? that should help make sure i get this right

Also i wasnt able to reproduce any error on rowStatus now but i could reproduce the rest. How does your call look? I just tried gridApi.rowStatus(0, 'error', 'Error'); I see no error but i do see that the data is blanked out on the row.

Here are the datagrid settings. Do you need to also see how the columns are set up?

    this.dataGrid.gridOptions = {
      uniqueId: VIEW_ID,
      columns: this.gridCols,
      dataset: result.datagrid.rows,
      selectable: 'single',
      idProperty: 'PanelKey',
      isList: false,
      editable: true,
      rowHeight: 'short',
      clickToSelect: true,
      showDirty: true,
      filterable: true,
      paging: true,
      pagesize: 25,
      pagesizes: [5, 10, 25],
      indeterminate: false,
      columnReorder: true,
      stretchColumn: 'last',
      hidePagerOnOnePage: true,
      redrawOnResize: true,
    // groupable: {fields: ['GroupName'], aggregator: ''},
      toolbar: {
        results: true
      },
      saveUserSettings: {
        rowHeight: true,
        pagesize: true
      },
    };

Here are a couple of examples on how we call rowStatus:

resetRowStatus(rowId) {
  // find the row by Id
  const index = this.dataGrid.dataset.findIndex(x => x.Id === rowId);
  if (index !== -1) {
    this.dataGrid.rowStatus(index, '', '');
  }
}

setRowError(rowId, message: string) {
  // find the row by Id
  const index = this.dataGrid.dataset.findIndex(x => x.Id === rowId);
  if (index !== -1) {
    this.dataGrid.rowStatus(index, 'error', message);
    this.dataGrid.scrollRowIntoView(index);
  }
}

QA Passed. Tested in http://master-enterprise.demo.design.infor.com/components/datagrid/example-grouping-editable.html across all browser, OS and devices. Thanks!

Was this page helpful?
0 / 5 - 0 ratings