React function component rowSelected

Hi!
Is there some example code for the rowSelected event within a function component?
Cheers
Alex

1 Reply 1 reply marked as answer

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team September 29, 2020 03:05 PM UTC

Hi Alexander, 

Thanks for contacting Syncfusion Support. 

Query#:- Is there some example code for the rowSelected event within a function component? 
 
We have checked your query and as per your requirement we have bind rowSelected event for TreeGrid within function component and define the corresponding event to get the rowIndex as like code below:- 
 
        const rowSelected = (args: any) => { 
            alert(args.data.rowIndex) 
        }; 
        return (<div><p>TreeGrid using Functional Components</p> 
            <TreeGridComponent dataSource={myData} treeColumnIndex={0} childMapping='childrens' rowSelected={rowSelected} > 
                <ColumnsDirective> 
                    {props.columns.map((c: any) => { 
                        return ( 
                            <ColumnDirective 
                                key={c.field} 
                                field={c.field} 
                                headerText={c.headerText} 
                                width={c.width} /> 
                        ) 
                    })} 
                </ColumnsDirective> 
 
            </TreeGridComponent> 
        </div> 
        ) 
    </script> 
 
 
Please get back to us if you need any further assistance. 
 
Regards, 
Farveen sulthana T 


Marked as answer
Loader.
Up arrow icon