(Ajax) Menu inside ClientTemplate inside ClientDetailTemplateId (which is also a grid)

3 posts, 0 answers
  1. Simon
    Simon avatar
    7 posts
    Member since:
    Sep 2012

    Posted 09 Oct 2012 Link to this post

    Lets say I have a grid, in which I reference ClientDetailTemplateId("historyTemplate").
    Then in my script template I have another grid. In that grid I have
    columns.Bound(t => t.Id)
                        .Items(menu => menu.Add()
                            .Items(sub =>
                                    .Url(Url.Action("Show", "Damage") + "/#= data.Id #")
                 .HeaderHtmlAttributes(new { style = "text-align:center;width:100px;" });
    Error I get on Chrome Console is 'Uncaught SyntaxError: Unexpected token ILLEGAL' Problem dissapears when I remove content of ClientTemplate (Html.Kendo.Menu...).

    My question is - how can I make menu inside ClientTemplate inside Detail Template work? Did I miss some escape character?
  2. Giacomo
    Giacomo avatar
    1 posts
    Member since:
    Dec 2013

    Posted 12 Dec 2013 Link to this post

    Have the same exact issue! Does anybody have a solution?
  3. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 14 Dec 2013 Link to this post

    Hello Guys,

    There are empty lines that are added when the scripts are rendered which break the nested templates.

    Here is what I tried on my side to make it work:

    <script id="template" type="text/kendo-tmpl">
                .Columns(columns =>
                    columns.Bound(o => o.OrderID).Width(70);
                    columns.Bound(o => o.ShipCountry).Width(110);
                    columns.Bound(o => o.ShipAddress);
                    columns.Bound(o => o.ShipName).Width(200);
                .DataSource(dataSource => dataSource
                    .Read(read => read.Action("HierarchyBinding_Orders", "Grid", new { employeeID = "#=EmployeeID#" }))

    Also you will need to evaluated the initialization scripts when the dataBound event of the Grid is triggered.

    I hope the code works the same way on your side too.

    Kind Regards,
    Petur Subev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top