简体   繁体   中英

How to add event listener to calendar Popup in Datebox in ZK?

How to add event listener to calendar Popup in Datebox in ZK?
'Datebox dateBox = new Datebox(dateObject);'

There is no server-side event for opening a datebox popup by default. Since opening a popup is a pure client-side action and no data changed. If you want to add a java listener, you can apply the attached js. That js will override databox widget to send an onOpen event to the server when you click the calendar icon to open the popup. Then you can call

dateBox.addEventListener("onOpen", new EventListener<Event>() {...});

zk.afterLoad('zul.db', function() {
    var exWidget = {};
    zk.override(zul.db.CalendarPop.prototype, exWidget, {
        open: function(silent){
            exWidget.open.apply(this, arguments);
            zAu.send(new zk.Event(this.parent, "onOpen", null, {toServer:true}));
        },
    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM