Skip to content

Commit

Permalink
added self closing behaviour for clickable listviews
Browse files Browse the repository at this point in the history
  • Loading branch information
WillemUXMendix committed Aug 15, 2016
1 parent ff57495 commit 0a1635b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ It's possible to use multiple DropdownDivConverter widgets on the same page. Tha
Since the dropdown menu is based on bootstraps dropdown button it is recommended to follow the applications Bootstrap theming rules with respect to buttons.

## Release Notes
Appstore 1.4 release:
- added self closing behaviour support for clickable listview (listviews with a microflow 'on click' property).

Appstore 1.3 release:
- added bootstrap glyphicon icon support: just add the "glyphicon-" classname to the settings.

Expand Down
17 changes: 15 additions & 2 deletions src/DropdownDivConverter/widget/DropdownDivConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
========================
@file : DropdownDivConverter.js
@version : 1.0
@version : 1.4
@author : Willem Gorisse
@date : Wed, 24 Jun 2015 15:15:32 GMT
@copyright : 2015 Mendix
Expand Down Expand Up @@ -155,14 +155,27 @@ define([

// Mendix buttons and links stop events from bubbling: set actions for internal button clicks to close the menu if needed
if (this.autoClose){
var internalButtons = domQuery("button, a",this.dropdownMenu);
var internalButtons = domQuery("button, a", this.dropdownMenu);
dojoArray.forEach(internalButtons, lang.hitch(this,function(node, i){
this.connect(node, "click", lang.hitch(this, function(e) {
if (this._isOpen){
this._toggleMenu();
}
}));
}));
// add logic to deal with listviews as they stop events from 6+
var internalListviews = domQuery(".mx-listview-clickable .mx-list", this.dropdownMenu);
dojoArray.forEach(internalListviews, lang.hitch(this,function(listNode, i){
var listItemClick = lang.hitch(this,function(e) {
if (this._isOpen){
this._toggleMenu();
}});
listNode.addEventListener('click', listItemClick,true);
// manually remove the eventlistener on destroy
this.addOnDestroy(function(){
listNode.removeEventListener('click', listItemClick, true)
});
}));
}

// set the action for the possible split group button
Expand Down
2 changes: 1 addition & 1 deletion src/package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://www.mendix.com/package/1.0/">
<clientModule name="DropdownDivConverter" version="1.0" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="DropdownDivConverter" version="1.4" xmlns="http://www.mendix.com/clientModule/1.0/">
<widgetFiles>
<widgetFile path="DropdownDivConverter/DropdownDivConverter.xml"/>
</widgetFiles>
Expand Down
Binary file modified test/Test.mpr
Binary file not shown.
Binary file modified test/widgets/DropdownDivConverter.mpk
Binary file not shown.

0 comments on commit 0a1635b

Please sign in to comment.