akveo / akveo/nebular

Tree grid does not successfully indent after datasource being re-instantiated

Abierto
#1,941 0 comentarios 0 reacciones 0 asignados Ver en GitHub
module:components needs investigation needs triage
Lenguaje dominante
TypeScript
Estrellas
8.1k
Forks
1.5k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Issue type

**I'm submitting a ...** (check one with "x")

* [X] bug report
* [ ] feature request

### Issue description

**Current behavior:**

When re-instantiating `this.dataSource`, the TreeGrid fails to indent any entries that have been programmatically expanded (using the `expanded` field or `this.dataSource.expand` or `this.dataSource.toggle`) but does indent entries when clicking them.
![failed-indentation](https://user-images.githubusercontent.com/22956519/64068000-37510b00-cc32-11e9-8555-f9e4b062fd18.png)

**Expected behavior:**
Elements should indent properly, when the `this.dataSource` is re-instantiated
![successful-indentation](https://user-images.githubusercontent.com/22956519/64068001-3b7d2880-cc32-11e9-8b37-c09cfe7bee17.png)

**Steps to reproduce:**
Code is same as from showcase from this [page](https://akveo.github.io/nebular/docs/components/tree-grid/examples#nbtreegridcomponent).
After having set the DataSource using the DataSourceBuilder
```ts
this.dataSource = this.dataSourceBuilder.create(this.data);
```
i make delete an entry from `this.data` and to reflect this, i re-instantiate `this.dataSource`
```ts
this.data.forEach(m => {
m.children.forEach(sa => {
const index = sa.children.findIndex(q => q.data.id === deleteId);
if (index !== -1) {
sa.children.splice(index, 1);
}
});
});
this.dataSource = this.dataSourceBuilder.create(this.data);
```
Now it will reset the `expanded` statuses to what was set in `this.data`. However it does not indent those expansions. It also won't indent anything that is expanded using `this.dataSource.expand` or `this.dataSource.toggle`.
When expanding an entry by clicking on it, it however successfully indents all the entries, that have not been indented properly.

### Other information:

**npm, node, OS, Browser**
```
Node: 10.13.0
NPM: 6.4.1
OS: Ubuntu 18.04
Browser: Chrome
```

**Angular, Nebular**
```
{
"name": "web",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.0",
"@angular/cdk": "^8.0.0",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"@nebular/auth": "^4.1.3",
"@nebular/eva-icons": "4.1.3",
"@nebular/moment": "^4.1.3",
"@nebular/security": "^4.1.3",
"@nebular/theme": "^4.1.3",
"eva-icons": "^1.1.1",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.802.2",
"@angular/cli": "~8.2.2",
"@angular/compiler-cli": "~8.2.0",
"@angular/language-service": "~8.2.0",
"@schematics/angular": "~8.2.0",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.