Can the yui3 construct of Y.on()
be used to setup listeners fo开发者_运维问答r events on yui2 widgets, or do they simply use separate event systems?
They use separate event systems. However, you can use Y.on() to set up DOM listeners that trigger methods on YUI 2 Widgets.
Y.on('focus', Y.bind(myCalendar.show, myCalendar), '#birthdate');
or more generically
Y.on('click', function () {
/* do other stuff... */
myDataSource.sendRequest('filter=active', {
success: myDataTable.onDataReturnInitializeTable,
scope: myDataTable
});
/* ...and more stuff */
}, '#date-filter');
Y.on() can't be used to subscribe to widget custom events in YUI 2, though.
Y.on('activeTabChange', thisWontWork, myTabView); // does nothing
精彩评论