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

PushCreate problem

1 Answer 115 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 14 Aug 2014, 01:08 PM
Hello,

When i add a newly created ObservableObject to a kendoDatasource with the pushCreate method,
the datasource wraps the ObservableObject instance into a new ObservableObject without checking if it is already a kendo.data.ObservableObject.
Due to this problem the uid changes ofcourse which makes it very hard to find the ObservableObject afterwards.

The problem is that the DataSource._createNewModel doesn't check if the model is already an ObservableObject.

_createNewModel: function(model) {
  if (this.reader.model) {
      return new this.reader.model(model);
  }
 
  return new ObservableObject(model);
 }

I think this should be changed to:

_createNewModel: function(model) {
  if (this.reader.model) {
      return new this.reader.model(model);
  }
 
  if (model instanceof ObservableObject) {
      return model;
  }
 
  return new ObservableObject(model);
 },

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 18 Aug 2014, 07:39 AM
Hi Marcel,

Thank you for your report. I have logged this as an issue here. We will fix it soon.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Data Source
Asked by
Marcel
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or