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

Problem adding Grid to Editor Template

3 Answers 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 01 Mar 2013, 03:42 PM
Problem 1:
I can't seem to get a grid in a Editor Template to work in a popup editor window of a grid.  I have attached a sample of this issue.  If you select the Grid Editor Menu Item you will see that it crashes.  If you remove the Html.Partial statement from the TopLevelItem Editor, you will see that it works.  To demostrate that the template works fine, I added a Direct Edit Menu ITem that calls the Template which led me to my second problem....

Problem 2:
If you use the Direct Edit menu item at first glance everything looks ok.  If you pay close attention to the dropdown for ItemType (not the one in the grid, that is itemtype2 and works fine), it doesn't select the correct default value.  Upon forther inspection, it doesn't seem to behave in the same manner as when inside the Grid Popup editor.  If you post it back, only the ID is trying to be return (inspect the Request object's Forms collection) but not the entire model.  The Item Type is null.  Again, this works fine inside a Grid Popup.

My intial thought was to host the editor in my own window using custom actions on the grid, but then I ran into problem 2.

Any thoughts on this?  Is this a bug?  Unintended use?

3 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 05 Mar 2013, 02:58 PM
Hi James,

 
Please note that when grid with PopUp editor template contains another grid which is editable, the second grid should be converted to client template using the ToClientTemplate method. Please check the example below:

Updated grid code:

@(Html.Kendo().Grid<MvcApplication1.Models.SecondLevelItem>()
    .Name("SecondLevelItems")
    .Editable()
    .DataSource(d =>
    {
        d.Ajax()
            .Read("GridEditor_SecondLevel_Read", "Home")
            .Update("GridEditor_SecondLevel_Update", "Home")
            .Model(m => m.Id(f => f.ID));
    })
    .Scrollable()
    .Columns(c =>
    {
        c.Bound(i => i.ID).Width(100);
        c.Bound(i => i.Description).Width(100);
        c.Bound(i => i.StartDate).Width(100);
        c.Bound(i => i.EndDate).Width(100);
        c.Bound(i => i.ItemType2).ClientTemplate("#=ItemType2.Description#").Width(100);
        c.Command(i => i.Edit()).Width(100);
    }).ToClientTemplate()
)

Also after checking the provided project it seems that is use unsupported version of jQuery (v.1.7.1) - please note that KendoUI v.2012.3.1315 supports jQuery v.1.8.2 and you should upgrade to it. For more information you can check the JavaScript dependencies article.

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
James
Top achievements
Rank 1
answered on 08 Mar 2013, 01:08 PM
That solved my first issue.  Any thoughts on the second one?  The drop down does not appear to behave in the same way that it does when inside the grid editor.  The value is not set and only the ID comes back when posted.
0
Vladimir Iliev
Telerik team
answered on 12 Mar 2013, 10:28 AM
Hi James,

 
Submitting input values using from element is not directly related to the KendoUI but to a general programming knowledge. Basically on form submit the values of all valid input elements will be submitted to the server and current behavior is expected.

Kind Regards,
Vladimir Iliev
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
James
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
James
Top achievements
Rank 1
Share this question
or