Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kendo UI angular - Grid - How to transform value?

How to transform values on Kendo Grid in regards of:

  • simple transformation like: kendo-grid-column field="value | uppercase" doesn't work
  • translation / internationalization - again kendo-grid-column field="value | translate" doesn't work
  • changing types from integer to string so integer can be filtered with kendo-grid-string-filter-cell which allows for search operations like "contains", "startswith"
like image 706
TomStack Avatar asked Jan 30 '23 01:01

TomStack


1 Answers

Not sure about support out of the box of kendo, but i am using angular pipes for this purpose. For example uppercase pipe is built-in pipe which you can use.

 <kendo-grid-column field="name" title="Name">
         <ng-template kendoGridCellTemplate let-dataItem>
            {{ dataItem.name | uppercase }}
        </ng-template>
    </kendo-grid-column>

or date pipe

<kendo-grid-column field="createdDate" title="Created">
        <ng-template kendoGridCellTemplate let-dataItem>
            {{ dataItem.createdDate | date:'dd.MM.yyyy HH:mm' }}
        </ng-template>
    </kendo-grid-column>

for some sophisticated stuff like translations you can create custom pipe.

like image 186
maxs87 Avatar answered Apr 26 '23 11:04

maxs87