PDA

View Full Version : [FIXED-94] Server Proxy doesn't apply sorters, limit, start to the request Parameters



crp_spaeth
20 Jun 2010, 9:39 AM
There seem to be a bug in the current Implementation of the Server Proxy.

Since the current Implementation applys the parameters limit sort sortDir etc to the root node of the Operation Object:



read: function(options) {
options = options || {};

Ext.applyIf(options, {
action : 'read',
filters: this.filters,
sorters: this.sorters,
group : {field: this.groupField, direction: this.groupDir},
start : 0,
limit : this.pageSize,

addRecords: false
});

var operation = new Ext.data.Operation(options);

return this.proxy.read(operation, this.onProxyRead, this);
},


And build Request doesen't extract those properties as Parameters they wont get sent to the Server:



buildRequest: function(operation) {
var params = Ext.applyIf(operation.params || {}, this.extraParams || {});

var request = new Ext.data.Request({
params : params,
action : operation.action,
records : operation.records,

operation : operation
});

request.url = this.buildUrl(request);


operation.request = request;

return request;
},

crp_spaeth
20 Jun 2010, 9:46 AM
As a quick and dirty Bugfix I am using this Override:


Ext.override(Ext.data.ServerProxy, {
buildRequest: function(operation) {
operation.params = Ext.applyIf(operation.params || {}, {
filters : operation.filters,
sorters : operation.sorters,
group : operation.group,
start : operation.start,
limit : operation.limit
});
var params = Ext.applyIf(operation.params || {}, this.extraParams || {});


var request = new Ext.data.Request({
params : params,
action : operation.action,
records : operation.records,

operation : operation
});

request.url = this.buildUrl(request);


operation.request = request;

return request;
}
});

edspencer
29 Jun 2010, 2:46 PM
Ok, I've put something similar into the ServerProxy so that all of those params are made available to the Ajax call. Will be available in next release.

This may well change over time as we find a good way to standardise client-server communication of these params.