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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

128812 Feb 10,2017 09:42 AM UTC Nov 24,2017 11:20 AM UTC JavaScript 5
loading
Tags: ejTreeGrid
Cristian Bellotto
Asked On February 10, 2017 09:42 AM UTC

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: [
                                        ej.TreeGrid.ToolbarItems.Add,
                                        ej.TreeGrid.ToolbarItems.Edit,
                                        ej.TreeGrid.ToolbarItems.Delete,
                                        ej.TreeGrid.ToolbarItems.ExpandAll,
                                        ej.TreeGrid.ToolbarItems.CollapseAll
                                   ]
                                 },
                                editSettings: {
                                    allowEditing: true,
                                    allowDeleting: true
                                },
                                toolbarClick: toolbarClick,
                                rowDataBound: assetRowDataBound
                              }">
</div>

Jonesherine Stephen [Syncfusion]
Replied On 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.
Regards,
 
Jone sherine P S 


Ugur Yilmaz
Replied On November 20, 2017 02:59 PM UTC

is there a solution for this incident? 

Suriyaprasanth Ravikumar [Syncfusion]
Replied On 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 “15.2.0.40”, please upgrade your source version to “15.2.0.40” or greater than this to use this feature. 
Please refer the code snippet below. 
[HTML] 
    
<div id="TreeGrid" data-bind="ejTreeGrid:{ expandStateMapping:'isExpand' ... }" style="width:100%;height:450px;"> 
    //.. 
</div> 
 
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. 

Thanks, 
Suriyaprasanth R 


Ugur Yilmaz
Replied On November 23, 2017 08:56 AM UTC

perfect. you saved my day :) thanks.

Suriyaprasanth Ravikumar [Syncfusion]
Replied On November 24, 2017 11:20 AM UTC

Hi Ugur, 

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

Thanks, 
Suriyaprasanth R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;