Author: Alex.Kolonitsky
Date: 2011-03-01 11:01:27 -0500 (Tue, 01 Mar 2011)
New Revision: 22005
Modified:
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
Log:
RF-10626 Panel Menu - @expandSingle doesn't work
Modified:
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js
===================================================================
---
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js 2011-03-01
14:27:15 UTC (rev 22004)
+++
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenu.js 2011-03-01
16:01:27 UTC (rev 22005)
@@ -51,19 +51,6 @@
this.activeItem = this.__getValueInput().value;
this.nestingLevel = 0;
- var menuGroup = this;
- if (menuGroup.options.expandSingle) {
- menuGroup.__panelMenu().bind("expand", function (event) {
- menuGroup.__childGroups().each (function (index, group) {
- if (event.target.id != group.id) {
- rf.$(group.id).__collapse();
- }
- });
-
- event.stopPropagation();
- });
- }
-
this.__addUserEventHandler("collapse");
this.__addUserEventHandler("expand");
},
@@ -208,6 +195,16 @@
return item.itemName == this.activeItem;
},
+ __collapseGroups : function (event) {
+ var topGroup = rf.$(event.target.id).__rfTopGroup();
+ this.__childGroups().each (function (index, group) {
+ if (group.id != event.target.id && (!topGroup || group.id !=
topGroup.id)) {
+ rf.$(group.id).__collapse();
+ }
+ });
+
+ },
+
destroy: function () {
rf.Event.unbindById(this.id, "."+this.namespace);
$super.destroy.call(this);
Modified:
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
===================================================================
---
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-03-01
14:27:15 UTC (rev 22004)
+++
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-03-01
16:01:27 UTC (rev 22005)
@@ -204,20 +204,10 @@
}
if (menuGroup.options.expandSingle) {
+ var component = this;
menuGroup.__group().bind("expand", function (event) {
- if (menuGroup.__isMyEvent(event)) {
- return;
- }
-
- menuGroup.__childGroups().each (function (index, group) {
- var rfGroup = rf.$(group);
- if (!rfGroup.__isMyEvent(event)) {
- rfGroup.collapse();
- }
- });
-
- //TODO nick - why?
- event.stopPropagation();
+ component.__rfPanelMenu().__collapseGroups(event);
+ event.stopPropagation();
});
}
Modified:
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
===================================================================
---
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2011-03-01
14:27:15 UTC (rev 22004)
+++
branches/4.0.X/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2011-03-01
16:01:27 UTC (rev 22005)
@@ -326,6 +326,11 @@
rf.Event.bindById(this.id, name, handler);
}
},
+
+ __rfTopGroup : function () {
+ var res = this.__item().parents(".rf-pm-top-gr")[0];
+ return res ? res : null;
+ },
destroy: function () {
var panelMenu = this.__rfPanelMenu();
Show replies by date