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
close icon

ejTreeGrid does not maintain nodes state (collapsed/expanded) after updating data source list

I have an ejTreeGrid whose item source is binded by knockout to an observable array. Whenever I update the array by adding or removing an element the state of the treegrid nodes is not maintained. All the nodes are expanded.
How can I prevent the nodes to be expanded every time?

This is my grid definition where 'assets' is the observable array.

<div id="assetsGrid" data-bind="ejTreeGrid: {
                               dataSource: assets,
                               idMapping: 'Id',
                               parentIdMapping: 'ParentId',
                               selectedRowIndex: selectedAssetGridRow,
                               enableVirtualization: true,
                               isResponsive: true,
                               enableResize: true,
                               rowHeight: 48,
                               enableCollapseAll: false,
                               columns: [{ field: 'Code', headerText: 'Code', width: 200, verticalAlignment: 'center' },
                                         { field: 'Description', headerText: 'Description' },
                                         { field: 'WrcName', headerText: 'Wrc' },
                                         { field: 'MaterialCode', headerText: 'Material Code' },
                                         { field: 'ExternalMaterialCode', headerText: 'Ext Material Code' },
                                         { headerText: 'Docs', isTemplateColumn: true, templateID: 'viewDocsColumnTemplate', textAlign: 'center', width: 50 }
                               toolbarSettings: {
                                   showToolbar: true,
                                   toolbarItems: [
                                editSettings: {
                                    allowEditing: true,
                                    allowDeleting: true
                                toolbarClick: toolbarClick,
                                rowDataBound: assetRowDataBound

5 Replies

JS Jonesherine Stephen Syncfusion Team February 11, 2017 05:29 AM UTC

Hi Cristian, 
At present there is no support for expand Mapping in Tree Grid. Please follow-up with the incident which is created under your account to track the status of this feature.
Jone sherine P S 

UY Ugur Yilmaz November 20, 2017 02:59 PM UTC

is there a solution for this incident? 

SR Suriyaprasanth Ravikumar Syncfusion Team November 21, 2017 12:27 PM UTC

Hi Ugur, 

As per your request, we have provided support for expand Mapping in TreeGrid, it already get included in our Essential studio version “”, please upgrade your source version to “” or greater than this to use this feature. 
Please refer the code snippet below. 
<div id="TreeGrid" data-bind="ejTreeGrid:{ expandStateMapping:'isExpand' ... }" style="width:100%;height:450px;"> 
var sampleData = [ 
          taskID: 1,  ... ,subtasks: [   ...   ]  
          taskID: 6,  ...  ,isExpand: false,subtasks: [   ...   ] 
We have also prepared a sample for your reference, Please find the sample link below. 

Suriyaprasanth R 

UY Ugur Yilmaz November 23, 2017 08:56 AM UTC

perfect. you saved my day :) thanks.

SR Suriyaprasanth Ravikumar Syncfusion Team November 24, 2017 11:20 AM UTC

Hi Ugur, 

Thank you for your update. We are glad that your requirement has been achieved.  

Suriyaprasanth R 

Live Chat Icon For mobile
Up arrow icon