问题
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>
回答1:
For data you can use npm install --save ng-pick-datetime
, This provide many features to play with date.
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'
}
}
}
}
}
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.
来源:https://stackoverflow.com/questions/53205217/ng2-smart-table-use-datepicker-format-in-the-field