Hi All!
I use igniteui igTreeGrid component (enableRemoteLoadOnDemand: true) with angular2.
import { Component } from '@angular/core';import { RoutingComponent } from '../navigation/route.decorator';declare var $: any;const dataUrl = '/nodes.json';@Component({ templateUrl: `<ig-tree-grid [(widgetId)]='id' [options]="tgridOptions"></ig-tree-grid>`})@RoutingComponent()export class UsersTreeView { private id: string = 'tgrid'; private tgridOptions: any; constructor() { this.tgridOptions = { autoCommit: true, autoGenerateColumns: false, dataSource: [], dataSourceUrl: dataUrl, enableRemoteLoadOnDemand: true, features: [ { name: 'Resizing' }, //{ name: 'RowSelectors', rowSelectorNumberingMode: 'sequential' }, //{ name: 'Selection' } ], initialExpandDepth: 0, primaryKey: "id", childDataKey: "objects", renderExpansionIndicatorColumn: true, height: "400px", width: "100%", columns: [ { key: "id", headerText: "id" }, { key: "name", headerText: "name" }, { key: "description", headerText: "description" } ] }; }}
And here's nodes.json structure
[ { "id": 0, "name": "Project Plan", "description": "6/2/2014", "objects": [] }, { "id": 1, "name": "Project Plan", "description": "6/2/2014", "objects": [ { "id": 3, "objects": [ { "id": 4} ], "name": "3" } ] }]
1. First node ({ "id": 0, "name": "Project Plan", "description": "6/2/2014", "objects": [] })
is not expanding instead of havingobjects(this is childkey) field array.
2. If treegrid options doesn't have dataSource (I'm using RemoteLoadOnDemand mode) property component gets error -Cannot read property 'length' of undefined
What settings I have lost to include into igTreeGrid to resolve such behaviour?
Thanks.
Hi Roman,
At this point not setting dataSource is not supported scenario. But I investigated this and logged an issue in github, so that we could support loadOnDemand capabilities into an Angular TreeGrid.
You can see the issue here https://github.com/IgniteUI/igniteui-angular2/issues/146
Once we got it solved you could verify your scenario. In my opinion when there is no data source the treegrid should not throw an error "Cannot read property 'length' of undefined"
Hi, Deyank!
I solved TreeGrid remote filling.
The reson was tha remote json-data must be bounded withDataKeyprop. (f.e. { data : [{......} ]} ).
Another question: how add addittional (remove unnecessary) request parameters which is passing to server side during node expanding?