Subgrid is not loading the data

3 posts, 1 answers
  1. chintan
    chintan avatar
    2 posts
    Member since:
    Jun 2016

    Posted 11 Nov 2016 Link to this post

    Hi All,

     

    I am using Kendo MVC subgrid with client template, and initially its working fine but since few days back subgrid is not loading any data.

    Here is my code for Grid. In my case when expanding sub grid its loading column but not the data and also dont seen any event for data load. 

     

    <h3 class="nvs">Search Results</h3>
       @(Html.Kendo().Grid<DealInfo>()
             .Name("SalesGrid")
             .Columns(columns =>
             {
             columns.Template(@<text></text>).ClientTemplate("<input type='checkbox' class='master'/>").Width(30);
                 columns.Bound(e => e.Nbr).Title("Nbr").Width(160);
                 columns.Bound(e => e.Name).Title("Name");
                 columns.Bound(e => e.Name1).Title("Name1");
                 columns.Bound(e => e.JobTYpe).Title("JobType");
             })
             .Sortable()
             .Scrollable()
             .ClientDetailTemplateId("template")
             .DataSource(ds => ds
                 .Ajax()
                 .PageSize(10)
                 .Read(r => r.Action("Action", "Controller").Data("jsview.GetSearchCriterion"))
             )
             .HtmlAttributes(new { style = "height:500px;" })
             .Pageable(p => p
                 .Numeric(true)
                 .PageSizes(new[] { 10, 20, 50 })
                 .PreviousNext(true)
             )
       )
       <div>
           <script id="template" type="text/kendo-tmpl">
     
               @(Html.Kendo().Grid<DealOrdersModel>()
                             .Name("grid_#=Nbr#") // template expression, to be evaluated in the master context
                             .Columns(columns =>
                             {
                                 columns.Bound(o => o.OrderNbr).Title("Order Number").HeaderHtmlAttributes(new { style = "white-space:normal" });
                                 columns.Bound(o => o.Date).Title("Date").Format("{0:MM/dd/yyyy}").HeaderHtmlAttributes(new { style = "white-space:normal" });
                                 columns.Bound(o => o.Type).Title("Type").HeaderHtmlAttributes(new { style = "white-space:normal" });
                                 columns.Bound(o => o.Type1).Title("Type1").Width(110);
                             })
                             .DataSource(dataSource => dataSource
                                 .Ajax()
                                 .PageSize(5)
                                 .Read(read => read.Action("Action1", "Controller", new { Nbr = "#=Nbr#" }))
                             )
                             .Pageable()
                             .Sortable()
                             .ToClientTemplate()
               )
     
     
           </script>
     
       </div>
  2. Answer
    Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 14 Nov 2016 Link to this post

    Hi Chintan,

    Can you please elaborate if you have made any changes prior to the failed loading of the data in the nested Grids? 

    Currently, the only thing that I could suggest is to inspect the browser's Network tab when you expand a parent item and see if the request to the "Action1" fails for any reason or if there are any JavaScript errors on the page. 


    Regards,
    Konstantin Dikov
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  3. chintan
    chintan avatar
    2 posts
    Member since:
    Jun 2016

    Posted 14 Nov 2016 in reply to Konstantin Dikov Link to this post

    Thanks for reply Konstantin,

    I solved this issue, the reason is grid is not calling action1 is .Name("grid_#=Nbr#") in the #=nbr# we are getting whitespace in the end so it could not call the Action1, once i trimmed the whitespace its working like charm.

     

    Regards,

    Chintan

Back to Top