Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#72 closed defect (fixed)

Flyout causes exception if container is missing

Reported by: pagameba Owned by: madair
Priority: P2 Milestone: 1.1
Component: Widgets Version: 1.0.6
Severity: Minor Keywords:
Cc: Browser: All
External ID: Operating System: All
state: New


Reported by David Hequet on fusion-users:

I noticed that creating Fusion template without a toolbar that include
Flyout or tweaking existing with Mapguide Studio can throw javascript error.
(tested with MapGuide Enterprise 2009 and MGOS 2.0, don't know what version
of Fusion is in).

IE: If you remove the FileMenu composant from an existing template (with
Studio) and render the layout in your browser, Fusion will try to render
sub-element from this toolbar (Map Menu and view Menu).
Because of the container (toolbar) does not exist, when Fusion try to add
the Flyout it throw a javascript error.

As the flyout menu is saved in the repository's ApplicationDefinition you
can remove the flyout from the toolbar then remove the toolbar from the
template (then it will not try to render, so no error).

I tweaked the Fusion's applicationdefinition.js code so it don't try to
render menu if container doesn't exist.

If you have better idea tell me, if my code tweak seems self-sufisant put it
in the next release :)

Here is the code :

Fusion.Lib.ApplicationDefinition.Item = Class.create();
Fusion.Lib.ApplicationDefinition.Item.prototype = {
           case 'Flyout':
               /* create a menu */

               var menu;
               var opt = {};
               opt.label = this.flyout.label;
               opt.tooltip = this.flyout.tooltip;
               opt.image = this.flyout.imageUrl;
               opt.imageClass = this.flyout.imageClass;
               if (container instanceof Jx.Toolbar) {
                   menu = new Jx.Menu(opt);
               } else if (container instanceof Jx.Menu ||
                          container instanceof Jx.ContextMenu ||
                          container instanceof Jx.SubMenu) {
                   menu = new Jx.SubMenu(opt);
               } else if (container == undefined) // if container does not
exist, does not create the menu
               this.flyout.create(widgetSet, menu);


Requires testing to reproduce and determine if there are other possible cases which could cause exceptions.

Change History (2)

comment:1 by pagameba, 14 years ago

Resolution: fixed
Status: newclosed

(In [1540]) Close #72. Only create widgets in a container if the container exists.

comment:2 by jbirch, 14 years ago

Is this something that should/could be applied to the 1.1 branch? The code looks similar in that location...

Note: See TracTickets for help on using tickets.