]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
[webui] enable any match mode for combo boxes
authorxhaggi <sascha.woo@gmail.com>
Fri, 5 Sep 2014 14:30:55 +0000 (16:30 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 8 Sep 2014 15:56:47 +0000 (17:56 +0200)
This enables the any match mode for combo boxes in the idnode.js which fix the issue that you can't search only for a service name within the service combo box.

src/webui/static/app/idnode.js

index a051862762403f619c15cb3342195ff95947756a..3f269bcc06512eb2d8ec615bbf0d857b641ce2be 100644 (file)
@@ -417,6 +417,50 @@ tvheadend.idnode_editor_field = function(f, create)
             };
             st.on('load', fn);
         }
+        
+        // any match mode
+        r.doQuery = function(q, forceAll){
+               q = Ext.isEmpty(q) ? '' : q;
+               var qe = {
+               query: q,
+                       forceAll: forceAll,
+                       combo: this,
+                       cancel:false
+               };
+                
+               if (this.fireEvent('beforequery', qe) === false || qe.cancel)
+                       return false;
+               
+               q = qe.query;
+               forceAll = qe.forceAll;
+               if (forceAll === true || (q.length >= this.minChars)) {
+                       if (this.lastQuery !== q) {
+                               this.lastQuery = q;
+                               if (this.mode == 'local') {
+                                       this.selectedIndex = -1;
+                                       if (forceAll) {
+                                               this.store.clearFilter();
+                                       }
+                                       else {
+                                               this.store.filter(this.displayField, q, true); // supply the anyMatch option
+                                       }
+                                       this.onLoad();
+                               }
+                               else {
+                                       this.store.baseParams[this.queryParam] = q;
+                                       this.store.load({
+                                               params: this.getParams(q)
+                                       });
+                                       this.expand();
+                               }
+                       }
+                       else {
+                               this.selectedIndex = -1;
+                               this.onLoad();
+                       }
+               }
+        };
+        
         return r;
         /* TODO: listeners for regexp?
          listeners       : {