cdotyone / mochaui

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

desktop.js -> setDesktopSize() bug #107

Open partikule opened 13 years ago

partikule commented 13 years ago

For internal use, I need to call the setDesktopSize() method of desktop.js (because I dynamically hide the desktop header, and the desktop size need to be recalculated after hidding the desktop header.)

Using the previous version, I just fired the window resize() event (this also doesn't work).

The error comes from the method panelHeight2()


panels.each(function(panel){
    var instance = MUI.get(panel.id);
       /**
        * The panel exists, but the panel.id is set to nothing
       */
    if (panel.getParent().hasClass('expanded') && panel.getParent().getNext('.expanded')){
...
}

I added a plaster, but I'm not convinced :

        panels.each(function(panel){
            var instance = MUI.get(panel.id);
            if (typeOf(instance) != 'null')
            {
partikule commented 13 years ago

I found some more informations about this bug. I init 2 panels, "structurePanel" and "mainPanel". When the I call setDesktopSize, one instance of "structurePanel" is in the panels array, but without any id.

Here is my init script, if it can help.

    MUI.create({
        'control':'MUI.Desktop',
        'id':'desktop',
        'taskbar':true,
        'content':[
            {name:'header', url: admin_url + 'desktop/get_header'},
            {name:'taskbar'},
            {name:'content',columns:[
                {id: 'sideColumn', placement: 'left', width: 280, resizeLimit: [222, 600],
                    panels:[
                        {
                            id: 'structurePanel',
                            title: '',
                            content: [
                                {url: admin_url + 'core/get_structure'},
                                {
                                    name: 'toolbox',
                                    position: 'header',
                                    cssClass: 'left',
                                    divider: false,
                                    url: admin_url + 'desktop/get/toolboxes/structure_toolbox'
                                }

                            ]
                        }
                    ]
                },
                {id: 'mainColumn',  placement: 'main', resizeLimit: [100, 300],
                    panels:[
                    {
                        id: 'mainPanel',
                        title: Lang.get('ionize_title_welcome'),
                        content: [
                            {url: admin_url + 'dashboard'},
                            {
                                name: 'toolbox',
                                position: 'header',
                                url: admin_url + 'desktop/get/toolboxes/empty_toolbox'
                            }
                        ]
                    }]
                }
            ]}
        ]
    });
partikule commented 13 years ago

Found more info about this problem. The "collapse" button returned also an error (panel.js -> collapse function())

A deeper check indicates that panelWrapper.getAllPrevious('.panelWrapper') returns 2 objects for the structurePanel_wrapper :

A check of the Panel initialize returns that the Panel object was just called 2 times, one time for the panel "structurePanel" and one time for the panel "mainPanel".

cdotyone commented 13 years ago

I think this was caused by drag event not being caputured during collapse/expand. This has been fixed. Please verify you are still having problem with newest code. -Chris