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

TreeView component does not render properly.

We have scenario here is that:
Fetch data from service.
Change object structure as per TreeView component structure.
Use getderivedstate function to change object structure and then update state
after doing above steps when component start rendering it does not render i have used below component in to render method of react component.

<TreeViewComponent
      ref={treeView => workActivities.treeViewComponentObj = treeView}
      cssClass='treeview-external-drag disable-ckeckboxes'
      fields={workActivities.fields}
      nodeTemplate={this.renderTreeViewNodes}
      />


why is the component not reading the change in dataSource and render the component.

Below is the post I was following but i did not got any concreet solution:


Regards,
Sonam Diwate


1 Reply

CI Christopher Issac Sunder K Syncfusion Team April 5, 2019 12:41 PM UTC

Hi Sonam, 

Greetings from Syncfusion!!! 

We have analyzed your requirement. Could you please let us know the following details. 
  1. How did you change object structure as per TreeView component structure after fetching the data in getderivedstate
  2. Could you please let us know the importance of using getderivedstate in your application rather than updating the state in componentDidMount.

Please check the below sample and modify it as per your application. 

Kindly share any code snippet if possible. It would be more helpful to proceed further. 

Thanks,
Christo 


Loader.
Live Chat Icon For mobile
Up arrow icon