cdotyone / mochaui

development tree for MochaUI
http://mochaui.org/demo/
Other
290 stars 83 forks source link

Modal - Window created from JSON #98

Open BrettonE opened 13 years ago

BrettonE commented 13 years ago

Hi Dev, when creating a new window via JSON response, if the type is set to modal1 or 2, the following client-side error is raised:

Error: $("modalOverlay") is null

I have managed to do a workaround, by creating/destroying a modal window at window onload, so the modalOverlay div is created and attached/made available to the DOM, before I create a modal window via newWindowsFromJSON

Thanks Mr B

oliverw commented 13 years ago

Creating Modal Windows seems to be broken at the moment. No matter wether you try it using MUI.create({ control: 'MUI.Modal'} .. (which crashes hard - see Issue #123) or try it using MUI.create({ control: 'MUI.Window', type: 'modal' ...

Would be nice if Chris or one of the developers could clarify the way to create modal Windows in Post 0.97 Versions.

moofoo commented 13 years ago

Check out my fork at https://github.com/moofoo/mochaui. The main objectives I had for the fork was to re-write demo-shared.js so that all the functions use the MUI.create({ syntax (so no more instances of the old 'new MUI.Window({... syntax), and to make it so all the UI behavior examples which are testable via the left-hand 'Examples' tree function correctly (including Modal windows).

I think the Modal window behavior might have been fixed in the course of implementing the handful of initial commits I made to fix some problems with general window control functionality (maximizing and restoring the window from the maximized state, specifically), and the commits related to problems with the Split Window example. So, while I do remember seeing the error you describe in Issue #123, it apparently had been fixed by the time I got around to directly testing the MUI.Modal control in my fork.

For reference, this is the object literal which successfully creates a Modal window when you click 'About' in the 'Help' dropdown menu:

      MUI.create({
        control:'MUI.Modal',
        id: 'about',
        title: 'MUI',
        content: {url: '{demo}pages/about.html'},
        type: 'modal2',
        width: 350,
        height: 195,
        padding: {top: 43, right: 12, bottom: 10, left: 12},
        scrollbars: false,
        onLoaded: function(){
            $('authorsAboutLink').addEvent('click', function(e){
                e.stop();                   
                Demo.authorsWindow();
            });
        }
    });
oliverw commented 13 years ago

Hi moofoo

I've tried out your branch but unfortunately I'm still getting the error described in Issue #123. Honestly I don't know what to do about that at the moment. Activity on the development branch seems to be pretty low so I'm not sure if mochaui - as much as I like it - is a viable option for a production app. Unfortunately all the other UI frameworks look kinda goofy compared to the clean look and feel of mochaui.

moofoo commented 13 years ago

what browser are you using? I hate to ask this, but you've tried clearing your browser's cache, right?

Just to clarify, I'm assuming that the error you describe is happening for you when you click the link named 'Modal Window' that is in the Tree of links in the left-hand column, under 'Windows'.

I tried out chrome, firefox (with firebug), opera and IE 9. The Modal opened correctly in all of them except IE 9, which seems to have a number of issues with the Demo. I tried clearing out my browsers cache, and then opening the demo page from the local file system (instead of opening the version on the local web server I'm running). Nothing wrong with the Modal window there. So, I've confirmed to myself at least, in a handful of different ways, that when I look at my branch, I'm not seeing the error you describe.

One final thought: if you're using firefox and firebug, make sure you've got the latest firebug version. Go to the firebug homepage to check this - I noticed some time ago that my installation of Firefox had stopped updating the installed firebug extension when newer versions came out, for whatever reason.

Regarding the current dev version of MochaUI - parts of it are ingenius, parts of it clearly need work. For my part, I'll be spending the next couple weeks working on my branch, as I need to create a version of it that runs a specific subset of the available UI function at production-ready levels of stability, and I also want to implement some optimizations I've come up with that ought to pretty substantially optimize load times and memory usage when user's are repeatedly loading pages in iframes that have large numbers of scripts, stylesheets and images into window and panel content. The optimizations are only relevant when all the pages are on the same domain, however (I'm working on an intranet site).

oliverw commented 13 years ago

I'm on Chrome stable (13.0.782.215 m) and I've cleared the cache even though all of my scripts are referenced with a "? " suffix so they should never be out of date.