RowDataBoundEventArgs no exported member

I'm trying to hook up the rowDataBound event of the Treegrid. In the instructions it says to import the RowDataBoundEventArgs  class via the statement below:


import {RowDataBoundEventArgsfrom '@syncfusion/ej2-treegrid';



I get an error that says @syncfusion/ej2-treegrid' has no exported member RowDataBoundEventArgs.
What am I doing wrong? Is the class name is different than the example?

5 Replies 1 reply marked as answer

ZA Zachary August 27, 2021 02:56 PM UTC

I may have solved this by importing from this instead:

'@syncfusion/ej2-grids


ZA Zachary August 27, 2021 03:17 PM UTC

This may not have been the correct answer.  I'm trying to change the row background color using this code:


It does not recognize the style property.



JR Jagadesh Ram Raajkumar Syncfusion Team August 30, 2021 11:24 AM UTC

Hi Zachary, 

Greetings from Syncfusion Support. 
Since treegrid is dependent on grid you can use the RowDataBoundEventArgs from the grid’s package. 

To change the background color of the row using rowDataBound event, please refer to the below sample. Since args.row will have a HTML element, we recommend using typecasting as shown in the below code snippet. 

rowBound(args: RowDataBoundEventArgs) { 
    if (args.data['duration'] == 0 ) { 
        (args.row as HTMLElement).style.background  = '#336c12'; 
    } else if (args.data['duration'] < 3) { 
        (args.row as HTMLElement).style.background= '#7b2b1d'; 
    } 
} 


Regards,
Jagadesh Ram 


Marked as answer

ZA Zachary August 30, 2021 03:16 PM UTC

Thanks Jagadesh, this was what I needed!



JR Jagadesh Ram Raajkumar Syncfusion Team August 31, 2021 05:59 AM UTC

Hi Zachary, 

Thanks for the update. Please get back to us if you have any other queries. 

Regards,
Jagadesh Ram 


Loader.
Up arrow icon