-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I got this script to override onClick tab event in order to use an onCustom event:
zk.afterLoad("zul.tab", function () {
var _xTab = {};
zk.override(zul.tab.Tab.prototype, _xTab, {
doClick_: function() {
this.fire("onCustom", null, {toServer:true});
}
});
});
Now, I want to use this script only for a specific tab. I tried this, but onCustom event is never fired:
<tab onCustom="@command('seleccionarTabTrazabilidad',item=item, evento=event.getTarget())">
<attribute w:name="_doClick"><![CDATA[
function () {
this.$_doClick(); //call the original method
this.fire("onCustom", null, {toServer:true});
}
]]>
</attribute>
</tab>
How should I do that?
Thank you!
Javier
Hi there!
The way I'd approach that for portability would be with a custom class: https://zkfiddle.org/sample/3aeced6/9-Another-new-ZK-fiddle
Otherwise, you'd have to go for this method to do it as an attribute: https://zkfiddle.org/sample/3aeced6/11-Another-new-ZK-fiddle
which is almost the same as what you were doing, with 2 small wrinkles:
1 - using doClick instead of doClick
2 - not calling super (super will start the regular doClick workflow, which I understand you don't want in this case?)
Asked: 2022-03-24 19:58:49 +0800
Seen: 7 times
Last updated: Mar 25 '22
How to Get ViewModel From a Tab class? [closed]
issue creating dynamic tabs via controller #2
issue creating dynamic tabs via controller #1
enhancement needed in scrolling tab in tabbox using javacode
Tabbox with Toolbar: how do I give the Toolbar all available space?
Tabbox and Notifications issue
Issue in Tab close event enhancement