本文介绍了Ng2-smart-table :在字段中使用日期选择器格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是否有可能在 ng2-smart-table 中使用 datepicker 格式.
Is there any probability that I can use datepicker format in the ng2-smart-table.
jobSettings2: object = {
columns: [
{
displayName: "Job ID",
valueAs: "JobID",
align: "left",
columnWidth: "",
type: "text",
required: true
},
<ng2-smart-table id="tableID" class="table table-hover" [settings]="jobSettings" [source]="jobSource" (userRowSelect)="selectjobs($event)"></ng2-smart-table>
推荐答案
对于数据,您可以使用 npm install --save ng-pick-datetime
,这提供了许多与日期相关的功能.
For data you can use npm install --save ng-pick-datetime
, This provide many features to play with date.
如果您想将日期选择器与 ng2-smart-table
一起使用,您可以通过它的名为 renderComponent 的属性来完成.
If you want to use date picker with ng2-smart-table
, you can do by it's property named renderComponent.
{
columns: {
startDate: {
title: 'Start Time',
type: 'custom',
renderComponent: SmartTableDatepickerRenderComponent,
width: '250px',
filter: false,
sortDirection: 'desc',
editor: {
type: 'custom',
component: SmartTableDatepickerComponent,
}
},
endDate: {
title: 'End Time',
type: 'custom',
renderComponent: SmartTableDatepickerRenderComponent,
width: '250px',
filter: false,
editor: {
type: 'custom',
component: SmartTableDatepickerComponent,
config: {
placeholder: 'End Time'
}
}
}
}
}
听说你必须由另一个组件管理.并且您必须将该组件呈现到 ng2-smart-table
中.
Hear you have to manage by another component. And you have to render that component into ng2-smart-table
.
有关更多信息,请查看此链接.
For more information please check this link.
这篇关于Ng2-smart-table :在字段中使用日期选择器格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!