Commit fd6aa439 authored by Pragnya Reddy's avatar Pragnya Reddy
Browse files

ENH: dropdown component

parent 48a34626
Pipeline #56375 passed with stage
in 1 minute and 49 seconds
......@@ -343,7 +343,6 @@ To use bootstrap-select options, use `options:`
</script>
```
// TODO: explain how 'change' event can be captured
### $.dropdown events
- `load` is triggered after dropdown is rendered
......
import * as default_templates from './dropdown.template.html'
import deepmerge from 'deepmerge'
import { urlfilter } from './urlfilter.js'
if (typeof jQuery != 'undefined') {
jQuery.extend(jQuery.fn, {
urlfilter: urlfilter
})
}
var default_options = {
target: '',
......
......@@ -41,14 +41,8 @@ export function urlfilter(options) {
href = '?' + $this.serialize()
else if (e.type == 'input' || e.type == 'change') {
var key = encodeURIComponent($this.attr('id') || $this.attr('name'))
if(Array.isArray($this.val()) && $this.val().length > 0) {
var val_obj = $this.val().map(function(value) {
return key + '=' + value
}).join('&')
href = '?' + val_obj
}
else
href = '?' + key + '=' + encodeURIComponent($this.val())
var val = encodeURIComponent($this.val())
href = '?' + key + '=' + val
}
var url = parse(href),
......
......@@ -85,8 +85,7 @@
$('.multiselect button').click()
$('.multiselect .dropdown-menu.inner a').click()
var hash = g1.url.parse(location.hash.replace(/^#/, ''))
//TODO: Make this test case work
t.deepEquals(hash.searchList['multicolor'], data_list)
t.deepEquals(hash.searchKey.multicolor, data_list.toString())
t.end()
$('.multiselect button').click()
})
......@@ -104,7 +103,7 @@
.on('load', function() {
$('.bs-select-all').click()
var hash = g1.url.parse(location.hash.replace(/^#/, ''))
t.deepEquals(hash.searchList['selectall'], data_list)
t.deepEquals(hash.searchKey.selectall, data_list.toString())
t.end()
})
.dropdown({ data: data_list, multiple: true, key: 'selectall',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment