@@ -23,6 +23,7 @@ import { IRowToggleEventArgs } from './tree-grid.interfaces';
23
23
import { TransactionService } from '../../services/transaction/transaction' ;
24
24
import { DOCUMENT } from '@angular/common' ;
25
25
import { IgxGridNavigationService } from '../grid-navigation.service' ;
26
+ import { IgxTreeGridRowComponent } from './tree-grid-row.component' ;
26
27
27
28
let NEXT_ID = 0 ;
28
29
@@ -79,23 +80,43 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
79
80
public flatData : any [ ] ;
80
81
81
82
/**
82
- * Returns an array of the root level `ITreeGridRecord`s.
83
- */
83
+ * Returns an array of the root level `ITreeGridRecord`s.
84
+ * ```typescript
85
+ * // gets the root record with index=2
86
+ * const states = this.grid.rootRecords[2];
87
+ * ```
88
+ * @memberof IgxTreeGridComponent
89
+ */
84
90
public rootRecords : ITreeGridRecord [ ] ;
85
91
86
92
/**
87
- * Returns a map of all `ITreeGridRecord`s.
88
- */
93
+ * Returns a map of all `ITreeGridRecord`s.
94
+ * ```typescript
95
+ * // gets the record with primaryKey=2
96
+ * const states = this.grid.records.get(2);
97
+ * ```
98
+ * @memberof IgxTreeGridComponent
99
+ */
89
100
public records : Map < any , ITreeGridRecord > = new Map < any , ITreeGridRecord > ( ) ;
90
101
91
102
/**
92
- * Returns an array of processed root `ITreeGridRecord`s.
93
- */
103
+ * Returns an array of processed (filtered and sorted) root `ITreeGridRecord`s.
104
+ * ```typescript
105
+ * // gets the processed root record with index=2
106
+ * const states = this.grid.processedRootRecords[2];
107
+ * ```
108
+ * @memberof IgxTreeGridComponent
109
+ */
94
110
public processedRootRecords : ITreeGridRecord [ ] ;
95
111
96
112
/**
97
- * Returns a map of all processed `ITreeGridRecord`s.
98
- */
113
+ * Returns a map of all processed (filtered and sorted) `ITreeGridRecord`s.
114
+ * ```typescript
115
+ * // gets the processed record with primaryKey=2
116
+ * const states = this.grid.processedRecords.get(2);
117
+ * ```
118
+ * @memberof IgxTreeGridComponent
119
+ */
99
120
public processedRecords : Map < any , ITreeGridRecord > = new Map < any , ITreeGridRecord > ( ) ;
100
121
101
122
/**
@@ -164,6 +185,15 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
164
185
return this . _expansionStates ;
165
186
}
166
187
188
+ /**
189
+ * Sets a list of key-value pairs [row ID, expansion state].
190
+ * ```typescript
191
+ * const states = new Map<any, boolean>();
192
+ * states.set(1, true);
193
+ * this.grid.expansionStates = states;
194
+ * ```
195
+ * @memberof IgxTreeGridComponent
196
+ */
167
197
public set expansionStates ( value ) {
168
198
this . _expansionStates = this . cloneMap ( value ) ;
169
199
this . cdr . detectChanges ( ) ;
@@ -235,6 +265,10 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
235
265
/**
236
266
* Expands the `IgxTreeGridRowComponent` with the specified rowID.
237
267
* @param rowID The identifier of the row to be expanded.
268
+ * ```typescript
269
+ * this.grid.expandRow(2);
270
+ * ```
271
+ * @memberof IgxTreeGridComponent
238
272
*/
239
273
public expandRow ( rowID : any ) {
240
274
this . _gridAPI . expand_row ( this . id , rowID ) ;
@@ -243,6 +277,10 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
243
277
/**
244
278
* Collapses the `IgxTreeGridRowComponent` with the specified rowID.
245
279
* @param rowID The identifier of the row to be collapsed.
280
+ * ```typescript
281
+ * this.grid.collapseRow(2);
282
+ * ```
283
+ * @memberof IgxTreeGridComponent
246
284
*/
247
285
public collapseRow ( rowID : any ) {
248
286
this . _gridAPI . collapse_row ( this . id , rowID ) ;
@@ -251,13 +289,21 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
251
289
/**
252
290
* Toggles the expansion state of the `IgxTreeGridRowComponent` with the specified rowID.
253
291
* @param rowID The identifier of the row to be toggled.
292
+ * ```typescript
293
+ * this.grid.toggleRow(2);
294
+ * ```
295
+ * @memberof IgxTreeGridComponent
254
296
*/
255
297
public toggleRow ( rowID : any ) {
256
298
this . _gridAPI . toggle_row_expansion ( this . id , rowID ) ;
257
299
}
258
300
259
301
/**
260
302
* Expands all rows.
303
+ * ```typescript
304
+ * this.grid.expandAll();
305
+ * ```
306
+ * @memberof IgxTreeGridComponent
261
307
*/
262
308
public expandAll ( ) {
263
309
this . _expansionDepth = Infinity ;
@@ -266,6 +312,10 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
266
312
267
313
/**
268
314
* Collapses all rows.
315
+ * ```typescript
316
+ * this.grid.collapseAll();
317
+ * ```
318
+ * @memberof IgxTreeGridComponent
269
319
*/
270
320
public collapseAll ( ) {
271
321
this . _expansionDepth = 0 ;
@@ -279,10 +329,8 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
279
329
* ```typescript
280
330
* const record = {
281
331
* ID: this.grid.data[this.grid1.data.length - 1].ID + 1,
282
- * parentID: null,
283
332
* Name: this.newRecord
284
333
* };
285
- * this.grid.addRow(record); // Adds a new row at level 0.
286
334
* this.grid.addRow(record, 1); // Adds a new child row to the row with ID=1.
287
335
* ```
288
336
* @param data
0 commit comments