Ng2-smart-table : 在字段中使用日期选择器格式

Ng2-smart-table : Use datepicker format in the field

有没有可能我可以在 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 ,这提供了许多与日期一起玩的功能。

如果您想将日期选择器与 ng2-smart-table 一起使用,您可以将其 属性 命名为 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

更多信息请查看此link.