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

Problem with adding external edit to the grid

1 Answer 47 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Miroslav
Top achievements
Rank 1
Miroslav asked on 03 Feb 2012, 08:07 PM
Hello all,

For a few hours I tried to create CRUD functionality but the only thing that I couldn't do was the create. In the attached file is the code I use. When I open the console I see the following error: Uncaught ReferenceError: tech_type_id is not defined.
Thank for the help in advance.


1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 06 Feb 2012, 10:07 AM
Hello Miroslav,

The error you are getting is caused by the fact that there is no tech_type_id defined when the new item is created. Therefore, you should describe your model in the schema declaration:

schema: {
      //..
       model: {
           id: 'tech_type_id',
           fields: {
               tech_type_id: { nullable: true },
               tech_type: "tech_type"
           }
       }
   }

And then create the new item:

var model = ds.add();
model.set("tech_type", $('#add_tech_type').val());
ds.sync();

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