- Home
- Forum
- Angular - EJ 2
- Grid date format Problem!
Grid date format Problem!
When i apply date format from ts file grid data is not shown. Contrary when i removed on html grid works and data is shown. In addition i applied pageSettings and there is no problem with it. What is the problem ?
<kt-portlet [class]="'kt-portlet--height-fluid'">
<kt-portlet-header [title]="'Order Statistics'">
</kt-portlet-header>
<kt-portlet-body>
<div class="control-section">
<ejs-grid [dataSource]='gridDataSource' allowPaging='true' height=365 [pageSettings]='initialPage' >
<e-columns>
<e-column field='description' headerText='Paket Adı' width='120' textAlign='Right'></e-column>
<e-column field='price' headerText='Ücret' width='150'></e-column>
<e-column field='createdAt' headerText='Oluşturulma Tarihi' [format] = 'formatoptions' width='130' textAlign='Right'></e-column>
</e-columns>
</ejs-grid>
</div>
</kt-portlet-body>
</kt-portlet>
@Component({
selector: 'kt-packagegroups',
templateUrl: './packagegroups.list.component.html',
styleUrls: ['./packagegroups.list.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class PackageGroupsListComponent implements OnInit {
packageGroups: IPackageGroup[] = [];
gridDataSource: Object[] = [];
public formatoptions = { format: 'dd/MM/yyyy' }
public initialPage = { pageSizes: true, pageCount: 4 };
constructor(private dataService: PackageDataService, private packageGroupService: PackageGroupService, private cdr: ChangeDetectorRef) {
}
ngOnInit() {
this.packageGroupService.getPackageGroups().subscribe(response => {
this.gridDataSource = response;
});
this.cdr.detectChanges();
}
}
SIGN IN To post a reply.
3 Replies
DR
Dhivya Rajendran
Syncfusion Team
February 5, 2020 08:46 AM UTC
Hi Tümer,
Greeting from Syncfusion support.
We have validated the provided information and we suspect that the first value of the date column might be null or undefined so that it cause the reported problem. By, default, when you are not specified the type for the column then it considered from the first value of the column so we suggest you to specify the type for column to resolve the problem.
|
<ejs-grid [dataSource]='data' height='350'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right'></e-column>
<e-column field='CustomerName' headerText='Customer Name' width='150'></e-column>
<e-column field='OrderDate' headerText='Order Date' type='date' width='130' [format]="format" textAlign='Right'></e-column>
</e-columns>
</ejs-grid>
|
|
export class AppComponent {
public data: Object[] = [];
public format = {type:'date', format:'dd/MM/yyyy'}
}
|
Documentation: https://ej2.syncfusion.com/angular/documentation/grid/columns/?no-cache=1#date-formatting
If you still face the problem then bind actionFailure event for grid and get back to us with the arguments details that will help us to validate further at our end.
Regards,
R.Dhivya
TÜ
Tümer
February 8, 2020 10:59 AM UTC
Hi Dhivya,
That's working now. Thank you!
Bests,
Tümer
That's working now. Thank you!
Bests,
Tümer
DR
Dhivya Rajendran
Syncfusion Team
February 10, 2020 05:42 AM UTC
Hi Tümer,
Thanks for your update.
We are happy to hear that the provided suggestion was helpful to resolve the problem. Please get back to us if you require further assistance.
Regards,
R.Dhivya
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
TÜ Tümer
- Feb 5, 2020 07:06 AM UTC
- Feb 10, 2020 05:42 AM UTC