Skip to content

Commit 0a1635b

Browse files
added self closing behaviour for clickable listviews
1 parent ff57495 commit 0a1635b

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ It's possible to use multiple DropdownDivConverter widgets on the same page. Tha
3434
Since the dropdown menu is based on bootstraps dropdown button it is recommended to follow the applications Bootstrap theming rules with respect to buttons.
3535

3636
## Release Notes
37+
Appstore 1.4 release:
38+
- added self closing behaviour support for clickable listview (listviews with a microflow 'on click' property).
39+
3740
Appstore 1.3 release:
3841
- added bootstrap glyphicon icon support: just add the "glyphicon-" classname to the settings.
3942

src/DropdownDivConverter/widget/DropdownDivConverter.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
========================
77
88
@file : DropdownDivConverter.js
9-
@version : 1.0
9+
@version : 1.4
1010
@author : Willem Gorisse
1111
@date : Wed, 24 Jun 2015 15:15:32 GMT
1212
@copyright : 2015 Mendix
@@ -155,14 +155,27 @@ define([
155155

156156
// Mendix buttons and links stop events from bubbling: set actions for internal button clicks to close the menu if needed
157157
if (this.autoClose){
158-
var internalButtons = domQuery("button, a",this.dropdownMenu);
158+
var internalButtons = domQuery("button, a", this.dropdownMenu);
159159
dojoArray.forEach(internalButtons, lang.hitch(this,function(node, i){
160160
this.connect(node, "click", lang.hitch(this, function(e) {
161161
if (this._isOpen){
162162
this._toggleMenu();
163163
}
164164
}));
165165
}));
166+
// add logic to deal with listviews as they stop events from 6+
167+
var internalListviews = domQuery(".mx-listview-clickable .mx-list", this.dropdownMenu);
168+
dojoArray.forEach(internalListviews, lang.hitch(this,function(listNode, i){
169+
var listItemClick = lang.hitch(this,function(e) {
170+
if (this._isOpen){
171+
this._toggleMenu();
172+
}});
173+
listNode.addEventListener('click', listItemClick,true);
174+
// manually remove the eventlistener on destroy
175+
this.addOnDestroy(function(){
176+
listNode.removeEventListener('click', listItemClick, true)
177+
});
178+
}));
166179
}
167180

168181
// set the action for the possible split group button

src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="DropdownDivConverter" version="1.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="DropdownDivConverter" version="1.4" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="DropdownDivConverter/DropdownDivConverter.xml"/>
66
</widgetFiles>

test/Test.mpr

64 KB
Binary file not shown.
189 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)