Click Event not fired in Toolbar

Hi, I'm using the Toolbar component in my React Typescript environment.
Unfortunately, the click event does not get fired when clicking on a button of the Toolbar. I have prepared a demo, where the problem appears: 
https://stackblitz.com/edit/react-ts-pcqdtd?file=index.tsx

Any idea?

3 Replies 1 reply marked as answer

NR Nevitha Ravi Syncfusion Team November 20, 2020 06:53 AM UTC

Hi Laurin, 

Greetings from Syncfusion Support. 

We have checked your shared sample in which you have raised the event in individual item which is the cause for the reported issue, you need to add clicked event in root element. Please refer the following code and sample. 

const onClick = (args: ClickEventArgs) => { 
    console.log(args.item.text + " clicked"); 
  }; 
 
 <ToolbarComponent clicked={onClick.bind(this)}> 

Please try the sample and get back to us if you need any further assistance. 

Regards, 
Nevitha   



LS Laurin S November 20, 2020 11:28 AM UTC

Ok, that works, thanks.

Just to know: For which reason/purpose do we have the option to set a click-event-handler on the single items, if they cannot be used for such purposes?

<ItemDirective click={clickHandler} /> //???


NR Nevitha Ravi Syncfusion Team November 23, 2020 11:34 AM UTC

Hi Laurin, 

Thanks for your update. 

We have checked the reported case at our end, click action need to bind for individual toolbar items. We confirm this as defect and logged bug report which can be tracked from the following link. The issue fix will be included in our weekly patch release scheduled on December 8, 2020. In the meantime, we suggest you to use clicked event in the root as shared in our previous post. 

Regards, 
Nevitha 


Marked as answer
Loader.
Up arrow icon