@@ -23,6 +23,7 @@ import { IRowToggleEventArgs } from './tree-grid.interfaces';
2323import { TransactionService } from '../../services/transaction/transaction' ;
2424import { DOCUMENT } from '@angular/common' ;
2525import { IgxGridNavigationService } from '../grid-navigation.service' ;
26+ import { IgxTreeGridRowComponent } from './tree-grid-row.component' ;
2627
2728let NEXT_ID = 0 ;
2829
@@ -79,23 +80,43 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
7980 public flatData : any [ ] ;
8081
8182 /**
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+ */
8490 public rootRecords : ITreeGridRecord [ ] ;
8591
8692 /**
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+ */
89100 public records : Map < any , ITreeGridRecord > = new Map < any , ITreeGridRecord > ( ) ;
90101
91102 /**
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+ */
94110 public processedRootRecords : ITreeGridRecord [ ] ;
95111
96112 /**
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+ */
99120 public processedRecords : Map < any , ITreeGridRecord > = new Map < any , ITreeGridRecord > ( ) ;
100121
101122 /**
@@ -164,6 +185,15 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
164185 return this . _expansionStates ;
165186 }
166187
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+ */
167197 public set expansionStates ( value ) {
168198 this . _expansionStates = this . cloneMap ( value ) ;
169199 this . cdr . detectChanges ( ) ;
@@ -235,6 +265,10 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
235265 /**
236266 * Expands the `IgxTreeGridRowComponent` with the specified rowID.
237267 * @param rowID The identifier of the row to be expanded.
268+ * ```typescript
269+ * this.grid.expandRow(2);
270+ * ```
271+ * @memberof IgxTreeGridComponent
238272 */
239273 public expandRow ( rowID : any ) {
240274 this . _gridAPI . expand_row ( this . id , rowID ) ;
@@ -243,6 +277,10 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
243277 /**
244278 * Collapses the `IgxTreeGridRowComponent` with the specified rowID.
245279 * @param rowID The identifier of the row to be collapsed.
280+ * ```typescript
281+ * this.grid.collapseRow(2);
282+ * ```
283+ * @memberof IgxTreeGridComponent
246284 */
247285 public collapseRow ( rowID : any ) {
248286 this . _gridAPI . collapse_row ( this . id , rowID ) ;
@@ -251,13 +289,21 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
251289 /**
252290 * Toggles the expansion state of the `IgxTreeGridRowComponent` with the specified rowID.
253291 * @param rowID The identifier of the row to be toggled.
292+ * ```typescript
293+ * this.grid.toggleRow(2);
294+ * ```
295+ * @memberof IgxTreeGridComponent
254296 */
255297 public toggleRow ( rowID : any ) {
256298 this . _gridAPI . toggle_row_expansion ( this . id , rowID ) ;
257299 }
258300
259301 /**
260302 * Expands all rows.
303+ * ```typescript
304+ * this.grid.expandAll();
305+ * ```
306+ * @memberof IgxTreeGridComponent
261307 */
262308 public expandAll ( ) {
263309 this . _expansionDepth = Infinity ;
@@ -266,6 +312,10 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
266312
267313 /**
268314 * Collapses all rows.
315+ * ```typescript
316+ * this.grid.collapseAll();
317+ * ```
318+ * @memberof IgxTreeGridComponent
269319 */
270320 public collapseAll ( ) {
271321 this . _expansionDepth = 0 ;
@@ -279,10 +329,8 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent {
279329 * ```typescript
280330 * const record = {
281331 * ID: this.grid.data[this.grid1.data.length - 1].ID + 1,
282- * parentID: null,
283332 * Name: this.newRecord
284333 * };
285- * this.grid.addRow(record); // Adds a new row at level 0.
286334 * this.grid.addRow(record, 1); // Adds a new child row to the row with ID=1.
287335 * ```
288336 * @param data
0 commit comments