是否可以将JSONP与Ext.form.Panel
一起使用?
答案 0 :(得分:0)
您应该创建自定义绑定。例如:
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;
}
}
});