I want to import data from external server in my GridPanel. I’ve tried with this code:
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{ name: 'HasError', type: 'string' },
{ name: 'ErrorString', type: 'char' }
]
});
var store = Ext.create('Ext.data.Store', {
model: 'User',
proxy: {
type: 'ajax',
url: 'http://.../GetActivities.aspx',
method: 'POST',
reader: {
type: 'json',
root: 'Data'
}
},
autoLoad: true
});
store.load();
Now I load it in my GridPanel.
xtype: "grid",
border: false,
store: store,
viewConfig: { forceFit: true },
flex: 1,
columns: [
{ header: "Aktivitätsnummer", width: 125, dataIndex: 'HasError', sortable: true },
{ header: "Zweck", width: 175, dataIndex: 'ErrorString', sortable: true }
]
I’ve tried the same code with a json file on the same server and it works
To avoid the security restrictions you need to make the web call on code behind.
You call your server with ajax, and on code behind you call and get the data from the other server using the
WebRequestthat asp.net provide.