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

Update DetailsRow content from serverside

Hello,

within DetailsRow i need to display other data than treegrid datasource. For example in tree grid i have a list PC and in DetailsRow i want to display all users of this PC.

How can i achieve this ?

Thank you.

1 Reply

JS Jonesherine Stephen Syncfusion Team November 17, 2016 10:54 AM UTC

Hi Guyot, 
We have prepared the work around and rendered the details template with different data source by using “detailsDataBound” client side event in TreeGrid. 
Please find the code example below: 
<ej:TreeGrid ID="TreeGridcontainer" runat="server" 
            DetailsTemplate="descriptionTemplate" 
            ShowDetailsRowInfoColumn="false" 
            ShowDetailsRow="true" 
            DetailsDataBound="databound"> 
        </ej:TreeGrid> 
<script id="descriptionTemplate" type="text/x-jsrender"> 
            <div id="container{{:Id}}"></div> 
</script> 
<script type="text/javascript"> 
            //Separate data source for resources 
            var resources = []; 
            var x = 0; 
            for (var i = 0; i < 16; i++) { 
                var parent = {}; 
                parent["Id"] = ++x; 
                parent["Name"] = "Resource " + x; 
                resources.push(parent); 
            } 
            function databound(args) { 
                for (var i = 0; i < resources.length; i++) { 
                    if (resources[i].Id == args.data.Id) { 
                        //we can append the required data to details template from here 
                        $("#container" + args.data.Id).append(resources[i].Name); 
                    } 
                } 
            } 
        </script> 
We have also prepared the sample based on this. And fetched the required resource name [separate datasource] for each task by comparing its Id value with TreeGrid Id value. And appended the obtained resource in a details template. Please find the sample from below location  
Disclaimer: We have removed bin and obj folder in the given sample for some security reasons, we must include Syncfusion.EJ and Syncfusion.EJ.Web dlls to render the TreeGrid control which is available in Essential Studio installed location.   
Please let us know if you require further assistance on this.
Regards, 
Jone sherine P S
  


Loader.
Up arrow icon