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

Sub-grid No Records Found not appearing

4 Answers 282 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CHRISTOPHER
Top achievements
Rank 1
CHRISTOPHER asked on 02 Oct 2015, 11:35 AM

Hello,

 

We are updating a project to the most recent release (2015.3.930), pretty much specifically to fix the whole "No records found" scenario.  Currently we use the javascript method people have come up with, putting a setTimeout on the DataBound event of the grid, but this is pretty unreliable and as such, when the official No Records Found came out, we would prefer to use that.

 

It seems however that in our most unreliable case (a nested grid, 5 levels down, business requirement), the now-built-in NoRecords is not working at all.  It works fine on single level grids, but in this instance, when the grid is a Client Template (using .ToClientTemplate() - we use the fluent API for MVC), it doesn't do anything.

 

I thought maybe it was because we had Pageable disabled (.Pageable(paging => paging.Enabled(false))) and so there was no footer, but even enabling this didn't make it work.  The footer correctly detects that there are no items found (as it displays that default message in the bottom right corner), but the .NoRecords("No Records Found!") does not render in the grid, or in the DOM at all.

 

The below is what gets rendered, which has no message for the no records found.

 

<table role="grid">
<colgroup>
<col style="width: 22%;">
<col style="width: 21%;">
<col style="width: 40%;">
<col style="width: 10%;">
</colgroup>
<thead class="k-grid-header" role="rowgroup">
<tr role="row">
...
</tr>
</thead>
<tbody role="rowgroup">
<tr class="k-no-data">
<td colspan="4">
</td>
</tr>
</tbody>
</table>

 

 The definition of the subgrid is as follows

 

<script id="SuperSubGridTemplate" type="text/kendo-tmpl">    
        @(Html.Kendo().Grid<ReportSuperSubGridVM>()
              .Name("SuperSubGrid")
              .Columns(column =>
              {
                  column.Bound(x => x.Column1).Width("22%").Title(@Resources.Global.Column1);
                  column.Bound(x => x.Column2).Width("21%").Title(@Resources.Global.Column2);
                  column.Bound(x => x.Column3).Width("40%").Title(@Resources.Global.Column3);
                  column.Bound(x => x.Column4)
                      .ClientTemplate("\\#if(Column4){\\# " + @Resources.Global.Yes + "\\#}else{\\#" + @Resources.Global.No + "\\#}\\#")
                      .Width("10%")
                      .Title(@Resources.Global.Column4);
              })

              .DataSource(dataBinding => dataBinding
                  .Ajax()
                  .PageSize(500)
                  .Read(read => read.Action("GetSuperSubGridData", Constants.Controller_Report, new
                  {
                      Parameter1 = "#=ParentColumn1#"
                      ,Parameter2 = "#=ParentColumn2#"
                      ,Parameter3 = "#=ParentColumn3#"
                      ,Parameter4 = "#=ParentColumn4#"
                      ,Parameter5 = "#=ParentColumn5#"
                      ,Parameter6 = "#=ParentColumn6#"
                      ,Parameter7 = "#=ParentColumn7#"
                      ,Parameter8 = "#=ParentColumn8#"
                      ,Parameter9 = "#=ParentColumn9#"
                      ,Parameter10 = "#=ParentColumn10#"
                  }))
                   .Sort(c => c.Add(x => x.Column1))
              )              
              .Scrollable(scrolling => scrolling.Enabled(false))
              .Sortable()
              .Filterable(filtering => filtering.Enabled(true))
              .Pageable(paging => paging.Enabled(false))
              .NoRecords(@Resources.Global.NoResultsFound)
              .ToClientTemplate()
 )
</script>

  

Again, this works on non-nested grids, but for some reason I can't seem to get it to work on this one.

 

Thank you for any help!

4 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 06 Oct 2015, 02:19 PM

Hello CHRISTOPHER,

 

I'm afraid I'm not able to re-create the issue you have described using the provided information. Could you please provide a small runnable sample in which the issue can be re-created locally. 

You should verify that there are no errors on the page as well as there are no errors returned by the server when the data is requested.

Also I have noticed that the Grid from the template snippet does no have unique Name set. You should set the Name of the Grid in such a way that every Grid widget instance created from the template has unique name. This can be achieved by using a code expression and the unique identifier of the parent Grid. This is demonstrated in this online demo.

 

Regards,
Rosen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
CHRISTOPHER
Top achievements
Rank 1
answered on 13 Oct 2015, 07:22 PM

Hello Rosen,

Sorry for the late reply, I was out of office last week.

 

I unfortunately cannot provide a sample as it is an internal application with no real way for me to fake the data in a concise format.  And since the actual data is confidential, I cannot even use real sample data.  In fact, I had to remove all the actual column names from my original post (hence the column1, 2, etc) and the template snippet grid name is actually generated uniquely using the #'s expressions with the parent column values, I just had to remove them for posting purposes.

 I can give a basic idea of the layout though:

 We have the top level grid (Level 0 for reference purposes in this description), which is just declared as a normal grid (@(Html.Kendo().Grid<TheSpecificViewModel>().... .ClientDetailTemplateId("Level1Template"))  and then we have a template Level1Template (again, with proper naming).  This template also contains a grid with a ClientDetailTemplateId specified, which has another template with a grid in it (Level2Template). etc.

 This repeats until "Level5Template" which no longer has a ClientDetailTemplateId, but just contains a grid.  On this Level5Template's grid, I specify the .NoRecords("No Results Found") configuration, but it never appears even when there are 0 results.  None of the levels from 0-4 can ever have no results found, so I don't have the call to .NoRecords specified on them.

I'm not sure if that could help you to recreate the situation on your side, but in total there are 6 levels of table (0-5) with only the bottom level (5) requiring the No Records Found functionality.

 

Before the 2015 releases, we used a popular javascript method on the DataBound event of this last grid, with a setTimeout delay in order to insert the No Records found message, which worked, but not consistently, since the timeout was sometimes not enough (and the Databound doesn't seem to fire after the rendering, so if it took a while, the timeout would fire before proper rendering and do nothing).

 

We actually upgraded to 2015 in this project specifically to fix this problem.

 

Any other ideas?

 

Thank you!

Christopher Derrig

0
Rosen
Telerik team
answered on 14 Oct 2015, 02:03 PM

Hello Christopher,

 

Unfortunately, as I have mentioned, we are not able to re-create the issue locally and there is little we can do without reproducing the issue. Thus, I have attached a test sample, which tries to re-create the scenario you have described. Please take a look maybe I'm missing something obvious. Feel free to modify it as the issue to appear and send it back to us for further investigation.

 

Regards,
Rosen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
CHRISTOPHER
Top achievements
Rank 1
answered on 14 Oct 2015, 03:33 PM

Hello Rosen,

 

I tested out your sample project and I too was unable to recreate the error, but in modifying it to try to get the error to happen, I stumbled upon the real cause of my problem.  There was a branching issue and the method signature for our controller function had been changed, but not the data parameters in the cshtml (one was missing) and so that was actually causing a post error which IE11 wasn't reporting in any way, but Chrome reported it as a 500 error.

 

I'm sorry for having spent your time on this!

 

Thank you for everything.

 

Tags
Grid
Asked by
CHRISTOPHER
Top achievements
Rank 1
Answers by
Rosen
Telerik team
CHRISTOPHER
Top achievements
Rank 1
Share this question
or