组合框项目工具提示不显示 [英] Combo box items tool tip not displayed

查看:89
本文介绍了组合框项目工具提示不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在ExtJs框架中编写了一个填充了项目的组合框。



以下是代码:

  $ 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 declaredata = [
['AL','阿拉巴马'],
['AK','阿拉斯加'],
['AZ'亚利桑那州],
['WV','西维吉尼亚州],
['WI','威斯康星州],
['WY','怀俄明']
]。

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

非常感谢任何指导。

解决方案

我假设您使用的是这个例子(该页面的第二个)作为起点? 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();

这篇关于组合框项目工具提示不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆