Clear selection from removed rows.
@@ -71,10 +71,15 @@ export default class IgniteListOfRegisteredUsersCtrl {
.then(() => {
const i = _.findIndex($ctrl.gridOptions.data, (u) => u._id === user._id);
- if (i >= 0)
+ if (i >= 0) {
$ctrl.gridOptions.data.splice(i, 1);
- })
- .then(() => $ctrl.adjustHeight($ctrl.gridOptions.data.length));
+ $ctrl.gridApi.selection.clearSelectedRows();
+ }
+
+ $ctrl.adjustHeight($ctrl.gridOptions.data.length);
+
+ return $ctrl._refreshRows();
+ });
};
const toggleAdmin = () => {
@@ -165,6 +170,8 @@ export default class IgniteListOfRegisteredUsersCtrl {
fastWatch: true,
exporterSuppressColumns: ['actions'],
exporterCsvColumnSeparator: ';',
+ rowIdentity: (row) => row._id,
+ getRowIdentity: (row) => row._id,
onRegisterApi: (api) => {
$ctrl.gridApi = api;
@@ -193,6 +200,8 @@ export default class IgniteListOfRegisteredUsersCtrl {
$ctrl.countries = _.values(_.groupBy(data, 'countryCode'));
$ctrl.adjustHeight(data.length);
+
+ $ctrl._refreshRows();
});
};
@@ -246,6 +255,13 @@ export default class IgniteListOfRegisteredUsersCtrl {
this.selected = ids;
}
+ _refreshRows() {
+ if (this.gridApi) {
+ this.gridApi.grid.refreshRows()
+ .then(() => this.selected.length && this._updateSelected());
+ }
+ }
+
exportCsv() {
this.gridApi.exporter.csvExport('visible', 'visible');
}
