且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

组合框项目工具提示不显示

更新时间:2023-10-13 23:06:35

我假设您使用的是这个例子(该页面的第二个)作为起点? tpl 应该参考示例中显示的有效模板(当然,您似乎正在使用abbr而不是nick,如在示例中 - make确保所有数据字段匹配)。您定义的模板未定义任何工具提示标记。例如:

 '< tpl for =。>< div ext:qtip ={state} nick}class =x-combo-list-item> {state}< / div>< / tpl>'

如果它仍然不起作用,请确保您在代码之前的某个地方初始化了快速提示单例:

  Ext.QuickTips.init(); 


I have written a combo box populated with items in ExtJs framework. I could not able to get the tooltips when the user hovers over the items.

Below is the code:

$formPanel .= " new Ext.form.ComboBox({
                tpl:'<tpl for =\".\"><div ext:qtip=\"{abbr}\" class=\"x-combo-list-item\">{state}</div></tpl>',
id:'type_blackout_weekly',
  store: sstore,
  displayField:'state',
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all',
  emptyText:'Select a state...',
  selectOnFocus:true,
  forceSelection: true,
  width:135
}),";

var statedata = [
  ['AL', 'Alabama'],
  ['AK', 'Alaska'],
  ['AZ', 'Arizona'],
  ['WV', 'West Virginia'],
  ['WI', 'Wisconsin'],
  ['WY', 'Wyoming']
];

var sstore = new Ext.data.SimpleStore({
  fields: ['abbr', 'state'],
  data : statedata 
});

Any guidance is highly appreciated.

I assume that you are using this example (the second one on that page) as your starting point? tpl should refer to a valid template like that shown in the sample (of course it looks like you are using "abbr" instead of "nick" as in the sample -- make sure all data fields match). Your template as defined does not define any tooltip markup. E.g.:

'<tpl for="."><div ext:qtip="{state}. {nick}" class="x-combo-list-item">{state}</div></tpl>'

If it's still not working, make sure you initialized the quick tips singleton somewhere before your code:

Ext.QuickTips.init();