【问题标题】:ExtJS Ext.form.Panel with JSONPExtJS Ext.form.Panel 与 JSONP
【发布时间】:2012-02-09 23:49:40
【问题描述】:

是否可以将 JSONP 与 Ext.form.Panel 一起使用?

【问题讨论】:

    标签: extjs jsonp


    【解决方案1】:

    您应该创建自定义绑定。示例:

    Ext.create('Ext.Panel', {
        renderTo: 'container',
        initComponent: function() {
            this.callParent(arguments);
    
            this.store = Ext.create('Ext.data.Store', {
                model: 'user',
                proxy: {
                    callbackKey: 'callback',
                    type: 'jsonp',
                    url: 'http://localhost/data2.php',
                    reader: {
                        type: 'json',
                        root: 'user'
                    }
                },
                autoLoad: true,
                listeners: {
                    load: function() {
                        this.onload();
                    },
                    scope: this
                }
            });
        },
        onload: function() {
            // do something with this.store.data
        },
        listeners: {
            destroy: function() {
                delete this.store;
            }
        }
    });
    

    【讨论】:

      猜你喜欢
      • 2015-12-18
      • 2014-01-15
      • 2013-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-02
      • 2011-03-14
      • 2014-08-27
      相关资源
      最近更新 更多