ng-grid行模板中的日期格式 [英] Date format in ng-grid row template
本文介绍了ng-grid行模板中的日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用以下列定义创建了一个ng-grid:
I've created a ng-grid with the following column definitions:
columns: [
{ field: "CompanyPkid", visible: false },
{ field: "CompanyName", visible: false },
{ field: "StartDate", visible: false, cellFilter: "date:'yyyy-MM-dd'" },
{ field: "CompanyId",
displayName: "Company ID",
cellTemplate: "<div class=\"ngCellText\" ng-class=\"col.colIndex()\">"+
"<a href=\"Company/Edit/{{row.getProperty('CompanyPkid')}}\">"+
"{{row.getProperty(col.field)}}"+
"</a><br />"+
"{{row.getProperty('CompanyName')}}<br />"+
"{{row.getProperty('StartDate')}}"+
"</div>",
}],
其中一列是隐藏的日期列.
One of the columns is an hidden date column.
其中一列使用模板,并包含隐藏日期列中的值.
One of the columns uses a template and includes the value from the hidden date column.
我想将多行列中的日期格式化为yyyy-MM-dd
.这可能吗?如果可以,怎么办?
I would like to format the date in the multiline column to yyyy-MM-dd
. Is this possible? If so, how?
推荐答案
Use the date
filter, like this:
{{row.entity.StartDate | date:'yyyy-MM-dd'}}
这篇关于ng-grid行模板中的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文