Our blazing fast Grid component built with pure JavaScript


Post by henrique »

Hi!

Do exists an event when the user clicks in the icon of the button? In my case I need to receive the click event of the icon in a tab of a TabPanel class.


Post by tasnim »

Hi,

There is no specific event to listen for the icon click in the button, But you can easily achieve it with a button click listener
Please check the codepen below, when you click on the button's icon It'll log a text in the console else not
https://codepen.io/dv-auntik/pen/mdoZrGx?editors=0011

Docs https://bryntum.com/products/gantt/docs/api/Core/widget/Button

Best regards,
Tasnim


Post by henrique »

Nice, it's works!

But stay the suggestion to create an event called "clickIcon", will be nice to have this!


Post by tasnim »

Thank you very much for your suggestion, I've opened an FR ticket for that here https://github.com/bryntum/support/issues/8675

Best of luck :)


Post by henrique »

Nice ticket, but my suggestion isn't do split the button, but create a new event to trigger when click in the icon.


Post by marcio »

Hey henrique,

I created a feature request ticket to add that event, please follow the updates/discussion there https://github.com/bryntum/support/issues/8679

Best regards,
Márcio


Post by mats »

@henrique Do you mind sharing some information about your usecase?

Would it suffice to add a new tabClick event with an `event´ param that lets you resolve the DOM target element? Or you'd like to not activate the tab when clicking the icon?


Post by henrique »

Sure!

I'm creating a system with tabs, when the user clicks in the menu, I open the tab with the form to the user fill the info, but the user can open more than one form, so I need an icon to the user close this tab. So, I put a X in the icon of the tab and now I need to know that the user clicked in this icon to close the tab. The solution showed here works, but it can be release to everybody use. Because of this I'm suggesting creating a new evento, only for the icon, because clicking in the tab, it active the tab.

PS: Of course, I'm using the TabPanel for this!


Post by mats »

So what you're looking for essentially is for tabs to be closable, correct?


Post by henrique »

Yes!

But I need to know that a tab was closed, to finish some variables in my system. Solves if I have the "Close" event too!


Post Reply