I wanted to add custom commands to the grid using the [commands] property. Everything is working as expected. But identifying the clicked command is a bit a struggle since the CommandModel class does not have and id property. Compared with ItemModel class of the toolbar the CommandModel lacks the id property. Thus I have to check on title or buttonOptions.content or
buttonOptions.title to find out which command was clicked. Because that properties might be localized this is not always easy.
My workaround is to add the following object as item of [commands] properts
// @ts-ignore
{ id: 'download', buttonOption: { cssClass: 'e-flat', iconCss: 'e-icons e-download' }, title: 'Download'}
within onCommandClicked I have the following code:
onCommandClicked(args: CommandClickEventArgs) {
const rowData = (args.rowData as IInvoice)
// @ts-ignore
if(args.commandColumn?.id === 'download'){
//todo
}
}
It might be cool to have an id property on CommandModel or CommandButtonOption too.
Regards,
Michael