组合框数据未显示在ie中

时间:2013-03-04 11:14:23

标签: extjs

 xtype:          'combo',
 mode:           'local',
 value:          '1',
 allowBlank:      false,
 triggerAction:  'all',
 forceSelection: true,
 editable:       false,
 fieldLabel:     'Is This Your Territory?',
 name:           'is_territory',
 hiddenName:     'is_territory',
 displayField:   'name',
 valueField:     'id',
 width: 230,
 store:          yesnoStore,

这是我的代码。为什么这没有显示在ie。

3 个答案:

答案 0 :(得分:0)

我检查了你的代码并在IE上运行。您是否定义了yesnoStore商店?或者也许只是代码末尾的额外昏迷:yesnoStore,,将其删除。

在脚本中包含商店,并且组合正常运行:

var yesnoStore = new Ext.data.ArrayStore({
    fields: ['id', 'name'],
    data : [['0','option_1'],['1','option_2'],['2','option_3'],['3','option_4']]
});

此示例正在使用IE,可能问题出在您的商店中。

{
        xtype: 'combo', 
        mode: 'local',
        value:'1',
        allowBlank: false, 
        triggerAction: 'all', 
        forceSelection: true, 
        editable: false, 
        fieldLabel: 'Is This Your Territory?', 
        name: 'is_territory', 
        hiddenName: 'is_territory', 
        displayField: 'name', 
        valueField: 'id', 
        width: 230, 
        store: yesnoStore
    }

答案 1 :(得分:0)

如果您已粘贴完整配置,则错误可能来自额外的逗号:

{
    xtype: 'combo',
    mode: 'local',
    value: '1',
    allowBlank: false,
    triggerAction: 'all',
    forceSelection: true,
    editable: false,
    fieldLabel: 'Is This Your Territory?',
    name: 'is_territory',
    hiddenName: 'is_territory',
    displayField: 'name',
    valueField: 'id',
    width: 230,
    store: yesnoStore, // < remove this comma
}

答案 2 :(得分:0)

即使语法正确,这也不起作用。 ExtJS 3.3.1(已确认)及以下(假设)有IE9的错误。 IE在加载页面时将组合框的高度设置为0.

我尝试了以下更改但没有成功:

  • 在配置
  • 中将高度设置为固定大小
  • 为组合框列表的类创建自定义CSS并设置高度
  • 为表示列表和设置高度的HTML元素的ID创建自定义CSS

到目前为止我找到的唯一解决方案:

升级到ExtJS 3.4.0或更高版本。这将修复此错误和许多其他绑定到IE9。

如果你去看sencha的例子,看看用IE9的3.3.1组合框的例子,它就不行了。如果您在3.4.0中检查组合框的示例,则它适用于IE9。

不幸的是,这不是一个选项,所以我将继续寻找另一个不涉及升级的解决方案。

希望这有帮助。