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

Property 'item' does not exist on type 'ClickEventArgs'.

Hi SF,
I have a Grid working in Angular with Firestore Data. All that is OK.

Using your code examples, I've tried to enable export to Excel and pdf, however, I am getting an error whereby, args.item.id throws an error.

Your Code from the examples:

  toolbarClick(args: ClickEventArgs): void {
    if (args.item.id === 'Grid_pdfexport') {
        const selectedRecords = this.grid.getSelectedRecords();
        const exportProperties = {
            dataSource: selectedRecords
        };
        this.grid.pdfExport(exportProperties);
    } else if (args.item.id === 'Grid_excelexport') {
        const selectedRecords = this.grid.getSelectedRecords();
        const exportProperties = {
            dataSource: selectedRecords
        };
        this.grid.excelExport(exportProperties);
     }
}

It would appear 'item' does not exist in ClickEventArgs. What is the correct method please?

Michael


3 Replies 1 reply marked as answer

RR Rajapandi Ravi Syncfusion Team April 10, 2023 01:19 PM UTC

Hi Michael,


Greetings from Syncfusion support


Based on your query we have prepared a sample and we tried to reproduce your reported problem at our end but it was unsuccessful. Please refer the below sample for your reference.


Sample:  https://stackblitz.com/edit/angular-u44ygt?file=src%2Fapp.component.ts,src%2Fapp.component.html


If you still face the issue, please try to reproduce the issue with our above attached sample and share the issue scenario in video demonstration format.


Regards,

Rajapandi R



MI Michael April 13, 2023 11:57 AM UTC

Hi Rajapandi,
Thanks for the Stackblitz sample.

The problem was ClickEventArgs in my code was coming from ej2-buttons. I replaced it with ej2-navigation as in the Stackblitz sample and it works fine.

Well done.


Michael




Marked as answer

SG Suganya Gopinath Syncfusion Team April 17, 2023 03:30 AM UTC

Hi Michael, 

We are glad that the issue has been resolved. Please get back to us for further assistance.

We are marking this ticket as solved. 


Loader.
Live Chat Icon For mobile
Up arrow icon