Hackpads are smart collaborative documents. Join Hackpad Now.
801 days ago
Unfiled. Edited by 徐啓洋 801 days ago
徐啓洋 Extjs combobox 模糊搜尋
 
(用於通訊錄系統)
 
加入代碼:
  • Ext.override(Ext.form.ComboBox, {
  •     doQuery : function(q, forceAll){
  •         if(q === undefined || q === null){
  •             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.anyMatch = this.anyMatch === undefined? false : this.anyMatch;
  •                 this.caseSensitive = this.caseSensitive === undefined? false : this.caseSensitive;
  •                         this.store.filter(this.displayField, q, this.anyMatch, this.caseSensitive);
  •                     }
  •                     this.onLoad();
  •                 }else{
  •                     this.store.baseParams[this.queryParam] = q;
  •                     this.store.load({
  •                         params: this.getParams(q)
  •                     });
  •                     this.expand();
  •                 }
  •             }else{
  •                 this.selectedIndex = -1;
  •                 this.onLoad();
  •             }
  •         }
  •     }
  • });  
 
並於 combobox config加入
'anyMatch: true' 
'caseSensitive: true' //選用
 
(未實際套用過)
 
1.於configuration加入
typeAhead: true
editable: true
2.加入listeners
  • listeners: {
  •         beforequery: function (record) {
  •             record.query = new RegExp(record.query, 'i');
  •             record.forceAll = true;
  •         }
  •     } 
 
 
876 days ago
Unfiled. Edited by Hao Wu 876 days ago
876 days ago
Unfiled. Edited by Hao Wu 876 days ago
Hao W Moving to a Plugin-Free Web
 
Oralce 在官方部落格指出也將不再支援瀏覽器的 plugin
 
 
 
Members (3)
Hao Wu 徐啓洋 amos lin

Create a New Collection

Cancel

Move XXX to XXX


XXX will be invited to the XXX on XXX.

Cancel

Contact Support



Please check out our How-to Guide and FAQ first to see if your question is already answered! :)

If you have a feature request, please add it to this pad. Thanks!


Log in / Sign up