combobox
にヒントを追加しようとしていますランタイム中に以下のコードを使用しますが、動作しません:
onStartReport: function (aButton) {
var lTip = Ext.getCmp('datasources');
lTip.setTooltip("Information on datasource");
}
私もこれを試しましたが、エラーが発生します:
onStartReport: function (aButton) {
var tip = Ext.create('Ext.tip.ToolTip', {
target: 'datasources',
html: 'Information on datasource'
});
}
クラシックを表示:
{
xtype: 'combo',
itemId: 'datasources',
name: 'datasources',
fieldLabel: 'Data sources',
displayField: 'description',
valueField: 'id',
queryMode: 'local',
value: 0,
forceSelection: true,
editable: false,
store: {
data: [
{id: 0, description: 'OnLine'},
{id: 1, description: 'History'}
],
fields: [
{name: 'id', type: 'int'},
{name: 'description', type: 'string'}
],
autoLoad: true
}
}
回答 1 件
このメソッドはうまくいくはずです:
問題は、コンポーネントに実際には
id
がないことです 、追加した唯一の構成はitemId
でした それらはまったく同じではありません。ドキュメントを参照してください。これもまた、なぜExt.getCmp('datasources')
動かない。これを修正する1つの方法は、単に
itemId
を変更することですid
へ 参照が見つかります。コンポーネントにidを追加したくない場合、itemIdを使用し続けるには、次のコードを使用できます。
onStartReport
を呼び出しているコンポーネント/コントローラーとの関係でコンボボックスを取得する3番目のオプションもあります 方法。 ここに例を追加しました:https://fiddle.sencha.com/#view/editor&fiddle/2hap