We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Child items not rendering when using templates

Hi,
I am having an issue with the listview where child items are blank after i click on a parent item.
If i remove the <Template> tag then everything works ok. All child nodes are visible. But when <Template> tag is added even with simple markup like...
<ListViewTemplates>
                    <Template>
                        @{
                            ListItem currentData = context as ListItem;
                            <div>@currentData.Text</div>...
                         }
                    </Template>

The parent nodes load fine but the child nodes are not there.
I am using code like the following to load the nodes...
ListData = (from to in topics
                    select new ListItem()
                    {
                        Id = "to" + to.TopicId,
                        Text = to.TopicName,
                        Icon = "folder",
                        Depth = 0,
                        Child = (from th in to.Threads
                                 where to.Enabled == true
                                 select new ListItem()
                                 {
                                     Id = "th" + th.ThreadId,
                                     Text = th.ThreadName,
                                     Icon = "file",
                                     Depth = 1,
                                     Child = (from me in th.Messages
                                              select new ListItem()
                                              {
                                                  Id = "me" + me.MessageId,
                                                  Text = me.MessageHeading,
                                                  Icon = "file",
                                                  Depth = 1
                                              }).ToList<ListItem>()
                                 }).ToList<ListItem>()
                    }).ToList<ListItem>();

In the debugger i can see all the child nodes and as mentioned when <Template> is removed it works find but when it is added it fails to load the child nodes.

Any ideas what may be causing this?

Thanks

1 Reply

MR Mohan Ravi Syncfusion Team September 30, 2019 08:38 AM UTC

Hi Fergus, 
  
We have checked the reported issue in Listview component with nested templates and we are unable to reproduce the reported issue as it is working as expected . 
  
Please verify that you are on the same version as the NuGet and CDN versions. Below links are referred to our latest version links (v17.3.0.10-beta). 
 
  
<link rel="stylesheet" rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.3.10/material.css"> 
  
And please make sure that you are on Dot Net SDK v3.0.100. 
 
Finally, increase the maximum transfer size of the SignalR connection, if you are using Server Side Blazor Application like below. 
  
[Startup.cs/Startup/ConfigureServices] 
services.AddServerSideBlazor().AddHubOptions(o => 
{ 
       o.MaximumReceiveMessageSize = 102400000; 
}); 
  
I have also attached a sample for your reference with nested template in Listview. Please check it in the below link. 
  
  
If none of this works, please modify or attach a sample with a reproducible issue, so that we can help you better and at earliest. 
  
Regards, 
Mohan 


Loader.
Live Chat Icon For mobile
Up arrow icon