javascript - ExtJS combobox problem in IE - Stack Overflow

I have an ExtJS bobox with a remote data store behind it. In all browsers it works fine, except in IE (

I have an ExtJS bobox with a remote data store behind it. In all browsers it works fine, except in IE (all versions that I've tested) where the bobox expands for a splitsecond, showing a "loading" icon and then it disappears again. Clicking it again after this doesn't make it expand at all anymore. Basically: it's not being populated.

On the server side, everything is fine. The Controller action is reached (using ASP.NET MVC) which returns Json data. The Json is properly formed (all other browsers swallow it at least).

A weird thing is, that when I put a breakpoint in the Controller action, the JsonStore is properly filled on the client side. This to me indicates some sort of timing problem.

Another weird thing is that, every once in a while, it works fine. Perhaps because the timing is just right by accident or something.

If I set the bobox mode to 'local' and force a .load() on the remote datastore, it works fine in IE too.

This problem is present in all boboxes that use a remote datastore for us.

I have the following JsonStore:

  var panies = new Ext.data.JsonStore({
    url: '/Company/GetCompanies/',
    root: 'panies',
    fields: [
    { name: 'CompanyID'},
    { name: 'CompanyName'}]
  });

The bobox:

new Ext.form.ComboBox({
    fieldLabel: 'Company',
    typeAhead: false,
    triggerAction: 'all',
    valueField: 'CompanyID',
    hiddenName: 'CompanyID',
    displayField: 'CompanyName',
    mode: 'remote',
    lazyRender: true,
    store: panies,
    allowBlank: true,
    editable: false,
    listeners: {
        'focus': function(){
          if(panies.data.length > 0)
          {
           debugger; // This is only ever fired after the aforementioned breakpoint method.
          }
        }
    }
})

The Json that is returned by the Controller:

{"panies":[{"CompanyID":1,"CompanyName":"Test"},{"CompanyID":2,"CompanyName":"Test1"
},{"CompanyID":3,"CompanyName":"Test2"}]}

I have an ExtJS bobox with a remote data store behind it. In all browsers it works fine, except in IE (all versions that I've tested) where the bobox expands for a splitsecond, showing a "loading" icon and then it disappears again. Clicking it again after this doesn't make it expand at all anymore. Basically: it's not being populated.

On the server side, everything is fine. The Controller action is reached (using ASP.NET MVC) which returns Json data. The Json is properly formed (all other browsers swallow it at least).

A weird thing is, that when I put a breakpoint in the Controller action, the JsonStore is properly filled on the client side. This to me indicates some sort of timing problem.

Another weird thing is that, every once in a while, it works fine. Perhaps because the timing is just right by accident or something.

If I set the bobox mode to 'local' and force a .load() on the remote datastore, it works fine in IE too.

This problem is present in all boboxes that use a remote datastore for us.

I have the following JsonStore:

  var panies = new Ext.data.JsonStore({
    url: '/Company/GetCompanies/',
    root: 'panies',
    fields: [
    { name: 'CompanyID'},
    { name: 'CompanyName'}]
  });

The bobox:

new Ext.form.ComboBox({
    fieldLabel: 'Company',
    typeAhead: false,
    triggerAction: 'all',
    valueField: 'CompanyID',
    hiddenName: 'CompanyID',
    displayField: 'CompanyName',
    mode: 'remote',
    lazyRender: true,
    store: panies,
    allowBlank: true,
    editable: false,
    listeners: {
        'focus': function(){
          if(panies.data.length > 0)
          {
           debugger; // This is only ever fired after the aforementioned breakpoint method.
          }
        }
    }
})

The Json that is returned by the Controller:

{"panies":[{"CompanyID":1,"CompanyName":"Test"},{"CompanyID":2,"CompanyName":"Test1"
},{"CompanyID":3,"CompanyName":"Test2"}]}
Share Improve this question asked Mar 25, 2009 at 15:01 JulianRJulianR 16.5k5 gold badges58 silver badges85 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

Figures, I work out the solution just minutes after posting a question about it.

I switched to a Store instead of a JsonStore and specified the method: 'GET' property of the proxy and it worked. I have no clue why this does work though, and why only IE had a problem with it. My Controller action accepts both GET and POST so that wasn't it.

The Store:

var panies = new Ext.data.Store({
      proxy: new Ext.data.HttpProxy({ url: '/Company/GetCompanies/', method: 'GET' }),
      reader: new Ext.data.JsonReader({ root: 'panies' }, [{ name: 'CompanyID', mapping: 'CompanyID' }, { name: 'CompanyName', mapping: 'CompanyName'}])
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745114395a4612042.html

相关推荐

  • javascript - ExtJS combobox problem in IE - Stack Overflow

    I have an ExtJS bobox with a remote data store behind it. In all browsers it works fine, except in IE (

    11小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信