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

TreeViewComponent error with nodeTemplate customComponent and Redux

Hi,

I'm working with TreeView using nodeTemplate function to indicate a customComponent, this custom component has more compoments that are connnected to redux store.
The customComponent works with no problem in others view/screens but when a try to use it in the TreeView with nodeTemplate, this fails, For example if a click Edit option that the edit component user redux appears the following error:

Uncaught Invariant Violation: Could not find "store" in the context of "Connect(CardInfoEditor)". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to Connect(CardInfoEditor) in connect options.

Do you have an example with redux for treeView or any advice?

Note: The Redux store, is using in a internal component from the customComponet used with nodeTemplate.

getCardTemplate(data){        
  return (<ItemCard cardInfo={data} />);        
}

render() {
     return (
          <TreeViewComponent ref="refTreeView" id={'tree-column-'+this.state.column.id}
              fields={this.state.fields} nodeTemplate={this.getCardTemplate} />
          );
}

Examples:

class ItemCard extends React.Component {
     render() {
          return (
               <CardInfoEditor data={this.props.cardInfo} />
          );
     }
}

class CardInfoEditor extends React.Component {
     render() {

        return (
            <div>{this.props.data.title}div>
        ).
    }
}

export default withStyles(styles)(connect(nullnull)(CardInfoEditor));


Thanks

1 Reply

KR Keerthana Rajendran Syncfusion Team December 17, 2019 08:55 AM UTC

Hi Porfirio, 
  
Thanks for contacting Syncfusion support. 
  
We have prepared a TreeView sample using React Redux with your shared code. In this sample we have rendered custom component using our nodeTemplate. Kindly refer to the below link for the sample. 
  
 
Refer to the following KB for more details on how to use react with redux. 
 
 
If we have misunderstood your requirement, please get back to us with complete code along with additional details on the difficulties you are facing while rendering TreeView using React Redux. This will be helpful for us to serve you better. 
  
Regards, 
Keerthana. 


Loader.
Up arrow icon