This is a migrated thread and some comments may be shown as answers.

Column format after push new item in datasource

2 Answers 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sergej
Top achievements
Rank 1
Sergej asked on 16 Dec 2015, 11:12 AM

Hi,
if a new item will added to datasource in the grid, then new values of item are not render in define format. (in e.g "date")
Miss i a command on data before or after pushing?
Here is my example code   : http://plnkr.co/edit/WIoAU0ZJOIus4pDblZpb?p=preview

2 Answers, 1 is accepted

Sort by
0
Stephen
Top achievements
Rank 2
answered on 16 Dec 2015, 07:52 PM

Change:

dataSource.pushCreate({ id: 3, name: "John Deep",age: 13 , anlagezeitpunkt: "2015-12-16T10:21:04.596Z"});

To:

dataSource.pushCreate({ id: 3, name: "John Deep",age: 13 , anlagezeitpunkt: kendo.parseDate("2015-12-16T10:21:04.596Z")});

 

For some reason, the grid will apply the formatting from the column definition during initialization but does not when adding a row directly to the dataSource after initialization...you have to essentially do it yourself, otherwise it just gets treated as a string.

 

It seems like a bug(or inconsistent behaviour) but there may be a good reason for it.  This is how I have dealt with it in my own code when adding rows programmatically.

 

 

0
Sergej
Top achievements
Rank 1
answered on 17 Dec 2015, 09:54 AM

Hi Stephen,
thanks for you answer. i found another way for problem solving (working with ObservableArray as data on datasource)

here is my problem-solving example.

Tags
Grid
Asked by
Sergej
Top achievements
Rank 1
Answers by
Stephen
Top achievements
Rank 2
Sergej
Top achievements
Rank 1
Share this question
or