https://stackblitz.com/edit/ng-date-picker-smart-table
npm install --save ng-pick-datetime
Add the component in this gist to your project
Add the following packages to your package.json at at least these versions: "ng-pick-datetime": "7.0.0" "ng2-smart-table": "1.5.0"
Add the following to your module:
import { FormsModule } from '@angular/forms';
import { OwlDateTimeModule, OwlNativeDateTimeModule } from 'ng-pick-datetime';
import { SmartTableDatepickerComponent, SmartTableDatepickerRenderComponent } from './your-path-to/smart-table-datepicker.component'
@NgModule({
imports: [
FormsModule,
OwlDateTimeModule,
OwlNativeDateTimeModule,
],
declarations: [
...,
SmartTableDatepickerComponent,
SmartTableDatepickerRenderComponent
],
entryComponents: [
...,
SmartTableDatepickerComponent,
SmartTableDatepickerRenderComponent
],
...
})
Add to your smart table settings:
{
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'
}
}
}
}
}
thx @brgaulin - yes that was missing and I added it now. I am following the link you mentioned. Still get this error:
where as dt is not declared in your example and it works. Any idea?