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:
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
@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!