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

Cancel edit dialog removing shape and dataItem

3 Answers 75 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Ralph
Top achievements
Rank 1
Ralph asked on 23 Feb 2015, 03:46 PM
Hello, 

I have come across an issue where shapes are being removed from the diagram when I choose to cancel the edit dialog. The issue seems to be tied to the schema of the dataSource. If I provide a mapping for the 'id' of elements in the dataSource using the cancel button on the edit dialog causes the shape and element to be removed: http://dojo.telerik.com/osOmA/7 

If this mapping is removed then the shapes function as expected.

Thanks

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 25 Feb 2015, 10:19 AM
Hello Ralph,

You should change the id field to "id" to avoid the problem:
schema: {
    model: {
      id: "id",
      fields: {
        id: { from: "Id", type: "number", editable: false },
        Text: { type: "string" }
      }
    }
}
The from option basically replaces the original field so "Id" will no longer be defined.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ralph
Top achievements
Rank 1
answered on 25 Feb 2015, 03:05 PM
Hi,

Thank you for the response, which does work around the problem. However, could you please enlighten me as to what the point of the mapping is in this case then? It seems like anything other than the following configuration seems to break the diagram. Even leaving this mapping off causes the diagram to break. 
model: {
  id: "id",
  fields: {
     ...
  }
}

Thanks
0
Daniel
Telerik team
answered on 27 Feb 2015, 11:32 AM
Hello again,

I am not sure if I understand the issue. What other configurations have you tried? 
Mapping the id field is not absolutely necessary. It will be done automatically by the model when setting the id option so you could use either:
model: {
  id: "id",
  fields: {
    id: { from: "Id", type: "number", editable: false },
    Text: { type: "string" }
  }
}
or:
model: {
    id: "Id",
    fields: {
        Id: { type: "number", editable: false },
        Text: { type: "string" }
    }
}
in the specific scenario.

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