Format kendo-ui-angular2 grid date column using pr

2019-07-15 04:39发布

Was wondering if it is possible to format a date in a column using a property. E.g:

<kendo-grid-column field="DOB" format="{0:d}" title="DOB" width="160"  >
    </kendo-grid-column>

I would like to format the DOB using a property. In my TS file I would have something like:

shortDate="dd/mm/yyyy"

In HTML:

<kendo-grid-column field="DOB" format="{0:shortDate}" title="DOB" width="160"  >
    </kendo-grid-column>

Something like that possible?

Thanks,

2条回答
女痞
2楼-- · 2019-07-15 04:54

For anyone in future's use, You can easily format it using below format property as below

<kendo-grid-column title="Received On" field="labReceivedDate" format="{0: dd MMM yyyy}" width="120px "></kendo-grid-column>
查看更多
走好不送
3楼-- · 2019-07-15 05:02

Solution I ended up using:

<kendo-grid-column field="DOB" title="DOB" width="160" >
        <ng-template kendoGridCellTemplate let-dataItem>
            {{dataItem.DOB | date:config.ShortDate}}
        </ng-template>
    </kendo-grid-column>
查看更多
登录 后发表回答