Browse Source

Dropdown can now have behaviors invoked on select

pull/1785/merge
jlukic 9 years ago
parent
commit
96a577d2c9
2 changed files with 31 additions and 18 deletions
  1. 6
      RELEASE-NOTES.md
  2. 43
      src/definitions/modules/dropdown.js

6
RELEASE-NOTES.md

@ -1,10 +1,10 @@
## RELEASE NOTES ## RELEASE NOTES
### Version 1.12.0 - March x, 2015
### Version 1.11.1 - March 5, 2015
**New Components**
- **Container** - Added a simple container element that can act as an alternative to `ui page grid`. Containers have fixed sizes which make layout resizing simpler than `page grid` which uses percentage width gutters. Containers also automatically scale for table and mobile
**Enhancements**
- **Dropdown** - Calling behaviors on a dropdown `select` will now automatically route them to the appropriate parent `ui dropdown`
**Bugs** **Bugs**

43
src/definitions/modules/dropdown.js

@ -75,25 +75,25 @@ $.fn.dropdown = function(parameters) {
module.debug('Initializing dropdown', settings); module.debug('Initializing dropdown', settings);
if( module.is.alreadySetup() ) { if( module.is.alreadySetup() ) {
module.error(error.alreadySetup);
module.setup.reference();
} }
else { else {
module.setup.layout(); module.setup.layout();
}
module.save.defaults();
module.set.selected();
module.save.defaults();
module.set.selected();
module.create.id();
module.create.id();
if(hasTouch) {
module.bind.touchEvents();
}
module.bind.mouseEvents();
module.bind.keyboardEvents();
if(hasTouch) {
module.bind.touchEvents();
}
module.bind.mouseEvents();
module.bind.keyboardEvents();
module.observeChanges();
module.instantiate();
module.observeChanges();
module.instantiate();
}
}, },
instantiate: function() { instantiate: function() {
@ -161,7 +161,6 @@ $.fn.dropdown = function(parameters) {
}, },
setup: { setup: {
layout: function() { layout: function() {
if( $module.is('select') ) { if( $module.is('select') ) {
module.setup.select(); module.setup.select();
@ -212,6 +211,21 @@ $.fn.dropdown = function(parameters) {
; ;
} }
module.refresh(); module.refresh();
},
reference: function() {
var
index = $allModules.index($module),
$firstModules,
$lastModules
;
module.debug('Dropdown behavior was called on select, replacing with closest dropdown');
// replace module reference
$module = $module.parent(selector.dropdown);
module.refresh();
// adjust all modules
$firstModules = $allModules.slice(0, index);
$lastModules = $allModules.slice(index + 1);
$allModules = $firstModules.add($module).add($lastModules);
} }
}, },
@ -1647,10 +1661,9 @@ $.fn.dropdown = function(parameters) {
} }
}) })
; ;
return (returnedValue !== undefined) return (returnedValue !== undefined)
? returnedValue ? returnedValue
: this
: $allModules
; ;
}; };

Loading…
Cancel
Save