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

Subgrid is not loading the data

2 Answers 238 Views
Grid
This is a migrated thread and some comments may be shown as answers.
chintan
Top achievements
Rank 1
chintan asked on 11 Nov 2016, 09:20 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 14 Nov 2016, 03:07 PM
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.
0
chintan
Top achievements
Rank 1
answered on 14 Nov 2016, 03:11 PM

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

Tags
Grid
Asked by
chintan
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
chintan
Top achievements
Rank 1
Share this question
or