I'm extending a view, the original of which has a list of click events:
I want to add the following to this list in my extended view
While also preserving the original list from the parent.
If I add just my new click event in the new view then it overwrites the parent's events object, so none of the original click events work.
I can make it work by copying the code for the whole event object from the parent .js file and adding my new entry on the end, but this isn't great. Is there any way to add an item to the object without having to redefine everything?
Code:
events: { 'click [data-action="run"]': function () { this.run(); this.afterRun(); }, 'click [data-action="refresh"]': function () { this.run(); }, 'click [data-action="printPdf"]': function () { this.actionPrintPdf(); }, ..... plus a bunch more
I want to add the following to this list in my extended view
Code:
'click [data-action="exportSpecialReport"]': function () { this.actionExportSpecial(); }
If I add just my new click event in the new view then it overwrites the parent's events object, so none of the original click events work.
I can make it work by copying the code for the whole event object from the parent .js file and adding my new entry on the end, but this isn't great. Is there any way to add an item to the object without having to redefine everything?
Comment