2011-10-26 9 views
2

コンボボックスを作成し、テンプレートに 'qtip'属性を挿入してQuickTipsを挿入します(this質問など)。 QuickTipsを除くすべての作品は、キーボードでコンボボックスの横に表示されません。Extjsキーボード選択時のコンボボックスのクイックヒント

キーボードでコンボリストをトラバースするときにクイックヒントを有効にする方法を知っている人はいますか? 私はextjs-3.4.0を使用しています ありがとうございました。


マイコンボです:

Ext.extend(Ext.form.ComboBox, { 
    tpl:'<tpl for="."><div ext:qtip="{tooltip}" class="x-combo-list-item">{item}</div></tpl>', 
    selectPrev:function() { 
     var ct = this.store.getCount(); 
     var idx = 0; 
     if (ct > 0) { 
      if (this.selectedIndex == -1) { 
       this.select(0); 
      } else if (this.selectedIndex !== 0) { 
       idx = this.selectedIndex - 1; 
       this.select(this.selectedIndex - 1); 
      } 
      var el = this.view.getNode(idx); 
      if (el) 
       eventFire(el, "mouseover"); 
     } 
    }, 
    selectNext:function() { 
     var ct = this.store.getCount(); 
     var idx = 0; 
     if (ct > 0) { 
      if (this.selectedIndex == -1) { 
       this.select(0); 
      } else if (this.selectedIndex < ct - 1) { 
       idx = this.selectedIndex + 1; 
       this.select(idx); 
      } 
      var el = this.view.getNode(idx); 
      if (el) 
       eventFire(el, "mouseover"); 
     } 
    }, 

    onViewOver:function (e, t) { 

     var item = this.view.findItemFromChild(t); 
     if (item) { 
      var index = this.view.indexOf(item); 
      this.select(index, false); 
     } 
    } 
}); 

答えて

0

簡単なヒントは、Qティップを配置するためにマウスイベントを使用していますので、これはあなたのために自動的に起きていない理由です。このような作業をするためにカスタムコードを書く必要があるかもしれません。

私は(または多分コンボのピッカーに)コンボへの適切なイベントにリスナーを添付し、あなたがそれをしたいQティップを配置するExt.Element機能(例えばalignToまたは多分getPosition)を使用しようとするだろう。 QTipマネージャを直接使用することさえできず、カスタムExt.Tipを作成する必要があるかもしれません。

さらに詳しい情報が必要な場合や、困ったときに追加のヒントが必要な場合はお知らせください。

+0

あなたが正しいです、私は解決された解決策を見つけました:カスタムComboBoxでメソッドselectNextとselectPrevをオーバーライドし、それらの最後に 'mouseover'イベントを発生させます。ありがとう! – ice

+1

投稿を編集して、次の人が再利用できるようにコードを表示する必要があります。 –

関連する問題