Sep 06, 2012, 9:56 PM
[CLOSED] Asynchronous server call to load store data from using custom proxy
hi,
Please let me know how would i go about making a remote call to the server when using the dynamic proxy below to load my data for the store.
please advise...
Please let me know how would i go about making a remote call to the server when using the dynamic proxy below to load my data for the store.
Ext.define('Ext.data.proxy.MyProxy', {
extend: 'Ext.data.proxy.Memory',
alias: 'proxy.myproxy',
alternateClassName: 'Ext.data.MyProxy',
read: function (operation, callback, scope) {
var me = this;
// I have overrode just this line:
// operation.resultSet = me.getReader().read(me.data);
operation.resultSet = me.getReader().read(me.onReadData.call(me, operation));
operation.setCompleted();
operation.setSuccessful();
Ext.callback(callback, scope || me, [operation]);
}
});
var getData = function (operation) {
var start = operation.start,
limit = operation.limit,
date = new Date(),
i,
data = [];
jQuery.ajax( { url: "/controller/getdata", ....
success: function (result) {
return {
data: result.data,
total: 8
};
}
};
I need to be able to load the data from the server for the store when the get data method is triggered during paging.var myProxyConfig = {
type: 'myproxy',
onReadData: getData,
reader: {
type: 'json',
root: 'data',
totalProperty: 'total'
}
};
please advise...
Last edited by Daniil; Sep 07, 2012 at 6:23 PM.
Reason: [CLOSED]