Skip to content

Commit f15e0c3

Browse files
authored
Merge pull request #4997 from IgniteUI/igxColumnComponent-Formatter-Code-Snippet
Updated Column Formatter API doc
2 parents d8cc5fd + 2277f6a commit f15e0c3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

projects/igniteui-angular/src/lib/grids/column.component.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,22 @@ export class IgxColumnComponent implements AfterContentInit {
388388
return this.grid.columns.indexOf(this);
389389
}
390390
/**
391-
* Gets formatter for the column.
391+
* When autogenerating columns, the formatter is used to format the display of the column data
392+
* without modifying the underlying bound values.
393+
*
394+
* In this example, we check to see if the column name is Salary, and then provide a method as the column formatter
395+
* to format the value into a currency string.
396+
*
392397
* ```typescript
393-
* let columnFormatter = this.column.formatter;
398+
* onColumnInit(column: IgxColumnComponent) {
399+
* if (column.field == "Salary") {
400+
* column.formatter = (salary => this.format(salary));
401+
* }
402+
* }
403+
*
404+
* format(value: number) : string {
405+
* return formatCurrency(value, "en-us", "$");
406+
* }
394407
* ```
395408
* @memberof IgxColumnComponent
396409
*/

0 commit comments

Comments
 (0)