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

how do i invoke component methods in reactjs?

For example, how do I use refresh for the ejTreeView?

https://help.syncfusion.com/api/js/ejtreeview#methods:refresh

How would I do this with a ReactJS component?

1 Reply

BP Balamurugan P Syncfusion Team February 15, 2017 08:59 AM UTC

Hi Christopher, 
Thanks for using Syncfusion Products.  

In ReactJS, you can call the “refresh” method of TreeView as specified in below code block. 

Code block: 
var DefaultTree = React.createClass({ 
    onRefresh: function (e) { 
             //$("#treeview").ejTreeView("refresh"); 
              var treeObj = $('#treeview').data("ejTreeView"); 
              treeObj.refresh(); 
    }, 
       onRemove: function(e){ 
              var treeObj = $('#treeview').data("ejTreeView"); 
              treeObj.removeAll(); 
       }, 
    render: function () { 
        return (    
        <div id="treeview-default">   
           <EJ.Button id="btnRefresh" size="medium" type="button" height={30} width={150} text="Refresh Tree" click={this.onRefresh}> 
           </EJ.Button>  
           <EJ.Button id="btnRemove" size="medium" type="button" height={30} width={150} text="Remove Tree" click={this.onRemove}> 
           </EJ.Button>  
           <EJ.TreeView id="treeview" fields={fields}> 
           </EJ.TreeView> 
        </div> 
        ); 
    } 
});   
 
ReactDOM.render(<DefaultTree />, 
       document.getElementById('treeview-default') 
); 


We have prepared a sample based on this and you can find the sample under the following location: 


Currently we have provided getting started details in our RectJS document.  Also, we have planned to update the document with further details in our upcoming release.  


Please let us know if you require any further assistance. 
 
Regards, 
Balamurugan P 


Loader.
Live Chat Icon For mobile
Up arrow icon