When a param in an Ajax request is an empty string, a null param is send to the server.
Now I fixed this with the following override
Code:
//Ext 4.2 Beta bugfix
Ext.override(Ext.Object, {
toQueryString: function(object, recursive) {
var paramObjects = [],
params = [],
i, j, ln, paramObject, value;
for (i in object) {
if (object.hasOwnProperty(i)) {
paramObjects = paramObjects.concat(ExtObject.toQueryObjects(i, object[i], recursive));
}
}
for (j = 0, ln = paramObjects.length; j < ln; j++) {
paramObject = paramObjects[j];
value = paramObject.value;
if (Ext.isEmpty(value)) {
value = '';
}
else if (Ext.isDate(value)) {
value = Ext.Date.toString(value);
}
// causes empty params in request
// params.push(encodeURIComponent(paramObject.name) +
// (value !== '' ? ('=' + encodeURIComponent(String(value))) : ''));
//previous code
params.push(encodeURIComponent(paramObject.name) + '=' + encodeURIComponent(String(value)));
}
return params.join('&');
}
});
ExtObject = Ext.Object;
Was there a reason to change the toQueryString? I see empty parameters as a form of information so it should be send to the server.