Wednesday, November 19, 2008

Exciting exploration with MooTools

Since last night the issue of how to go about opening a new mochaui window from within an iFrame caused me less sleep. But thanks to the posts I read that lead me to a solution, (one of which is ... that I should supply the local relative path to the intended page, rather than make mochaui think it's coming from another domain. See snippet below:

    MochaUI.mainWindow = function(){
        new MochaUI.Window({
            id: 'mainWindow',
            title: 'ePinoy Business Directory',
            closable: false,
            resizable: true,
            maximizable: true,
            y: 85,
            x: 20,
            loadMethod: 'iframe',
            contentURL: '../../../directory/index.php',
            /*contentURL: '',*/
            scrollbars: true,
            padding: { top: 10, right: 10, bottom: 10, left: 10 },
            width: 700,
            height: 390

The commented part is my original code, that caused me to mull over the codes I wrote since late that afternoon.

By the way, since the app I modified is intentionally loaded in a mochaui window, and this app has links to initiate calls to another mochaui windows in its parent, so, simply need to include the mootools.js and construct your event binding codes.

I hope this will save a bit of time for those who'll wonder why their codes don't work ;)

No comments: