-
28 Jan 2008 7:04 AM #1
YUI to EXT translation
YUI to EXT translation
Hi,
I'm trying to translate a code that was written for YUI to EXT:
cross-frame
I don't want to use yui adapter and I need it to be as small as possible.
What files to I need to include - ext-base.js and or ext-core.js?
What are the equivalents to these:
YAHOO.env.ua.opera
YAHOO.lang.hasOwnProperty
YAHOO.util.CustomEvent
YAHOO.util.Event.addListener
YAHOO.util.Dom.get
YAHOO.util.CrossFrame.onMessageEvent.subscribe
YAHOO.util.CrossFrame.onMessageEvent.fire
YAHOO.util.Event.stopEvent
Thanks
-
28 Jan 2008 10:15 AM #2
-
28 Jan 2008 10:44 AM #3
Wow, I haven't used YUI in over a year, since finding ExtJS, but I'll take a guess, that you can get by getting the functionality needed by included "ext-all.js" and 'ext-base.js', or you can build your own ExtjS, but this requires you know a bit more about the source and what you need. The examples provided in the examples folder of the project are the best reference.
YAHOO.env.ua.opera - this gets done automatically in the core of ExtJS I believe... never had to write anything specific to appeal to Opera.
YAHOO.lang.hasOwnProperty - not sure...
YAHOO.util.CustomEvent
Ext.get([id string of element]).addEvent('blah');YAHOO.util.Event.addListener
Ext.get([id string of element]).on('click',function () {
...... put your code for the event here.....
Ext.fireEvent('blah',this); // look up more examples of this in source and forum...
});
See my example above for this... the on('click'.... is short for addListener, I believe....
YAHOO.util.Dom.get
Ext.getDom([string of id]) or for an element Ext.get([string of id])... see the docs.
YAHOO.util.CrossFrame.onMessageEvent.subscribe
YAHOO.util.CrossFrame.onMessageEvent.fire
not sure on these...
YAHOO.util.Event.stopEvent
Ext.EventManager.stopEvent is something I don't use alot, but may provide clues. The source code for the ExtJS Widgets is always a good place to look for more info. I like the Ext.Window and Ext.MessageBox source code.
-
28 Jan 2008 11:18 AM #4
The code provided in the link uses url fragment identifiers and a porxy iframe to allow cross-frame and cross-domain communication.
All you have to do it to put a small proxy.html file on the distant server.
After the first call the proxy file is being cached so you don't call the server again.
This could be a great user extension and IMO better the the dynamic script syntax because it allow you to use ajax calls.
Including ext-all.js is out of the question because you need to load the code both in the main window and in the iframe.
The orignal code uses yahoo-dom-event.js which is 10K gzipped.
I'm trying to find the Ext equivalent and keep it small but I'm afraid it is not so simple.
Thanks


Reply With Quote