Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use input type=search on the filter widget

commit a6c4bb321b3a46c90fee541e1e4883c0f8c484f2 1 parent 4bc1481
Eric Hynds authored
Showing with 14 additions and 6 deletions.
  1. +1 −1  jquery.multiselect.filter.css
  2. +13 −5 src/jquery.multiselect.filter.js
2  jquery.multiselect.filter.css
View
@@ -1,3 +1,3 @@
.ui-multiselect-hasfilter ul { position:relative; top:2px }
.ui-multiselect-filter { float:left; margin-right:10px; font-size:11px }
-.ui-multiselect-filter input { width:100px; font-size:10px; margin-left:5px; height:15px; padding:2px; border:1px solid #292929 }
+.ui-multiselect-filter input { width:100px; font-size:10px; margin-left:5px; height:15px; padding:2px; border:1px solid #292929; -webkit-appearance:textfield; -webkit-box-sizing:content-box; }
18 src/jquery.multiselect.filter.js
View
@@ -30,18 +30,26 @@
header = (this.header = instance.menu.find(".ui-multiselect-header").addClass("ui-multiselect-hasfilter")),
// wrapper elem
- wrapper = (this.wrapper = $('<div class="ui-multiselect-filter">'+(opts.label.length ? opts.label : '')+'<input placeholder="'+opts.placeholder+'" type="text"' + (/\d/.test(opts.width) ? 'style="width:'+opts.width+'px"' : '') + ' /></div>').prependTo( this.header ));
+ wrapper = (this.wrapper = $('<div class="ui-multiselect-filter">'+(opts.label.length ? opts.label : '')+'<input placeholder="'+opts.placeholder+'" type="search"' + (/\d/.test(opts.width) ? 'style="width:'+opts.width+'px"' : '') + ' /></div>').prependTo( this.header ));
// reference to the actual inputs
this.inputs = instance.menu.find(":checkbox, :radio");
// build the input box
- this.input = wrapper.find("input").bind("keydown", function( e ){
+ this.input = wrapper
+ .find("input")
+ .bind("keydown", function( e ){
// prevent the enter key from submitting the form / closing the widget
if( e.which === 13 ){
- return false;
+ e.preventDefault();
}
- }).bind("keyup", $.proxy(self._handler, self) );
+ })
+ .bind("keyup", $.proxy(self._handler, self) )
+ .bind("click", function(){
+ if( !this.value.length ){
+ self._handler();
+ }
+ });
// cache input values for searching
this.updateCache();
@@ -100,7 +108,7 @@
self = self.children();
}
- // see _create() in jquery.multiselect.js around line 96
+ // see _create() in jquery.multiselect.js
if( !self.val().length ){
return null;
}
Please sign in to comment.
Something went wrong with that request. Please try again.