Use EQ filter for text filters in columns with type number
authorJoey Schulze <joey@infodrom.org>
Sat, 21 Dec 2013 22:08:38 +0000 (23:08 +0100)
committerJoey Schulze <joey@infodrom.org>
Sat, 21 Dec 2013 22:08:38 +0000 (23:08 +0100)
lib/rico/ricoLiveGrid.js

index f005f4d..855245a 100644 (file)
@@ -2074,7 +2074,12 @@ filterKeypress: function(e) {
   if (v=='' || v=='*')
     this.setUnfiltered();
   else {
-    this.setFilter('LIKE', v, Rico.TableColumn.USERFILTER, function() {txtbox.value='';});
+    var colnum = parseInt(txtbox.id.split('_').pop(),10);
+    if (typeof this.options.columnSpecs[colnum].type != 'undefined' &&
+       this.options.columnSpecs[parseInt(colnum,10)].type == 'number')
+       this.setFilter('EQ', v, Rico.TableColumn.USERFILTER, function() {txtbox.value='';});
+    else
+       this.setFilter('LIKE', v, Rico.TableColumn.USERFILTER, function() {txtbox.value='';});
   }
 },