Done! It works now in firefox as well as it does in IE. Thanks you all! Here's the js function I changed in the DojoMenuBar2.script file:
dojo.addOnLoad(function() { if(dojo.byId("${componentId}")!=null){ var menuBar = dojo.widget.createWidget("MenuBar2", {contextMenuForWindow:${contextMenu}}, dojo.byId("${componentId}")); var menuItem; <foreach expression="menuItems" key="item" index="count"> menuItem = dojo.widget.createWidget("MenuBarItem2", {submenuId:"${item.menuId}", caption:"${item.caption}",disabled:${item.disabled}}); menuBar.addChild(menuItem, false, "insertAtIndex", null, ${count}); </foreach> } else { var menuBar = dojo.byId("${componentId}"); var menuItem; } }); -----Original Message----- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: terça-feira, 19 de setembro de 2006 14:56 To: Tapestry users Subject: Re: Re: Tacos MenuBar and Ajax To answer number 2, yes. That's what the component should have been doing the whole time. On 9/19/06, Denis Souza <[EMAIL PROTECTED]> wrote: > > Well, I suppose I just got lucky since the only two dojo widgets that I've > used from Tacos were exactly the MenuBar and the TabContainer ;) > I finally gave up on since I didn't really *need* it, just would be nice > to > have it. > I agree, MenuBar leaves much to be desired but since in my case it's use > will be limited it was a very cost-effective solution, really easy to > implement. I got my whole menu structure working in a few minutes (well, > except for the ajax part). > > About sam's e-mail, 2 things: > 1) I saw the bug in IE in which the menu items appear at the very top. > From > what I could test it happens because the menu items are always placed at > the > beginning of their parent tags, for instance: > > <div> > ... some stuff here > My menu here > </div> > This wouldn't work because the menu items would appear at the same place > as > the other stuff. A workaround would be: > > <div> > ... some stuff here > </div> > <div> > My menu here > </div> > At least worked for me... > > 2) I'm not sure I fully understand the menubar/ajax problem. I thought the > problem was that the request was executing the javascript code again, when > it shouldn't, thus creating a new menubar. I searched the Tacos dev list > like you told me to find a "new dojo tapestry widgets" thread but I really > wasn't very much enlightened by it. > Anyway, please correct me if I'm wrong. I looked at the Tacos source code > and the way I see it now, in order to make it work, I'd have to replace > the > DojoMenuBar2 component with a slightly altered version that will check if > the menu (with the same name) already exists before creating it, i.e., not > call dojo.widget.CreateWidget when it's not necessary. > I'm no expert on javascript, and I don't know exactly if that's what you > were thinking. Any ideas? > > Denis > > > -----Original Message----- > From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] > Sent: segunda-feira, 18 de setembro de 2006 21:54 > To: Tapestry users > Subject: Re: Re: Tacos MenuBar and Ajax > > Two small thoughts on this. > > -) WRT the javascript not getting executed, this is annoying but not > really > a "bug" in dojo. If you look at some of the other tacos components you'll > find that their script templates use the ResponseBuilder to determine if > they are in an ajax request and respond appropriately..(Ie either execute > immediately or execute upon window/package load depending..) > > -) The Menu widget ~is~ horribly slow..It was written by some of the same > people involved in writing the TabContainer. I hope it doesn't give people > a > bad impression of dojo devs as this is only one part of the community. I > recently added a new "tab like" widget which should be extremely fast..It > can do a lot more than just "tabs" as it is very generic, but there is at > least an alternative. . > > > http://archive.dojotoolkit.org/nightly/tests/widget/test_RadioGroup_tabs.htm > l > > In fact - the same widget could probably handle dynamic menus + tabs with > equal ease as it's based on a UL/OL and css class names. No images/css > templates/etc are loaded by the widget. It works completely off of what > you > give it so there shouldn't be any hidden css behaviour to drive you nuts. > > > On 9/18/06, Sam Gendler <[EMAIL PROTECTED]> wrote: > > > > Yeah. Currently, the dojo components don't handle ajax updates well. > > I was new to tacos and wasn't aware of the problem until I wrote code > > that triggers it. Due to the nature of the structure of our page, > > however, the extra menu bar shows up in a part of the page which is > > never visible, so I've been able to ignore it during a schedule > > crunch. We've almost released, after which I can devote some time to > > improving all the dojo widgets I contributed. The others all send > > javascript during ajax requests, even when not being updated, but > > because of the way I structured them, the 2nd javascript just doesn't > > do anything. Andreas or Jesse described a fix to me on the tacos-dev > > mailing list, if you want to search for it. It shouldn't be too > > difficult to fix (just search for 'sgendler'). > > > > Personally, I find that the menubar, as implemented in dojo, leaves a > > TON to be desired. It renders itself really slowly and causes massive > > delays in the rendering of other dojo code on the page. It also shows > > all menu items stacked on top of each other before finally spreading > > them out, and in IE, if your menu isn't at the very top of the page, > > the menu items appear at the very top of the page until you mouse over > > the area where they are supposed to be, at which point, they drop down > > to where they are supposed to be. In short, it is basically > > unworkably in a production quality app. We finally ditched it for a > > CSS solution which is about 1,000 times faster. Incidentally, those > > are all dojo issues, not tap/tacos ones. The same problems occur in > > our page mockups. > > > > --sam > > > > On 9/19/06, andyhot <[EMAIL PROTECTED]> wrote: > > > Denis Souza wrote: > > > > Hi, > > > > > > > I think the original contributor of those components described such > > > a behaviour at > > > http://thread.gmane.org/gmane.comp.java.tacos.devel/2040/ > > > > > > If this is indeed the cause, we'll try to resolve it before the (soon > to > > > come) next release > > > > > > > > > > > > I'm using Tacos' DojoMenuBar component to create a menu in my > > application > > > > but whenever I use ajax on the same page as the menu I get strange > > behavior > > > > in Firefox 1.5 (IE 6 works fine). After the ajax request loads > another > > menu, > > > > identical to the original, is created near the updated part of the > > page. I'm > > > > guessing Firefox is executing all "onload" javascript methods after > > each > > > > ajax request, thus, repeating the menu creation. > > > > > > > > Anyone know if there's an easy way out of this? > > > > > > > > > > > > > > > > Denis > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr > > > Tapestry / Tacos developer > > > Open Source / J2EE Consulting > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > Jesse Kuhnert > Tapestry/Dojo/(and a dash of TestNG), team member/developer > > Open source based consulting work centered around > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]