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

Grid popup edit mode create dialog js error

1 Answer 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
chris
Top achievements
Rank 1
chris asked on 02 Apr 2013, 02:37 PM
Hi,

I'm using the mvc wrappers and getting a javascript error when clicking the create button.  I'm using jquery 1.9.1, ive tried 1.8.1 and get same error.  Here's my razor markup.  Anyone know whats going on here?  

The js error is in the image but the message is "Uncaught TypeError: Cannot read property 'Name' of undefined.

@(Html.Kendo().Grid<PosAdmin.Areas.Config.Models.ConfigProject>()
    .Name("grid")
    .Columns(c =>
    {
        c.Bound(m => m.Description);
        c.Bound(m => m.Id);
        c.Bound(m => m.Team.Name);
        c.Bound(m => m.Name);
        c.Bound(m => m.Team.Description);
        c.Command(command => { command.Edit(); command.Destroy(); }).Width(160);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable()
    .Sortable()
    .Scrollable()
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Model(model => model.Id(p => p.Id))
        .Create(update => update.Action("CreateProject", "ConfigEditor",new {Area="Config"}))
        .Read(read => read.Action("ProjectsRead","ConfigEditor",new {Area="Config"}))
        .Update(update => update.Action("EditingInline_Update", "Grid"))
        .Destroy(update => update.Action("EditingInline_Destroy", "Grid"))
    )
)

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 04 Apr 2013, 11:22 AM
Hello Chris,

Make sure that you have specified default value for that Team object:

http://docs.kendoui.com/getting-started/web/grid/editing#declare fields definition through the datasource schema


and through the wrappers like this:

http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/configuration#model


Kind regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
chris
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or