PDA

View Full Version : [3.0RC1]pagingToolBar and zero



TopKatz
16 Apr 2009, 5:34 AM
This is probably a bug, but figured I would start here.

Starting to plow through getting 3.0 running and all of my paging grids are not working. It looks like zero "0" is getting striped out for some reason. It has been manifesting it self with the start param, however it effects limit as well.

If I change start to 1 it works, and if I change limit to 0 it send blank.

EDIT - it looks to be all 'GET' requests. That any param that is an int = 0 is evaled to blank.

16 Apr 2009, 5:47 AM
Katz,

Confirmed. I know its a behavior change, not too sure if i would consider it a bug.

For others to see this, load: http://extjs.com/deploy/ext-3.0-rc1/examples/grid/paging.html and look the post parameters for topic-browse-remote.php

TopKatz
16 Apr 2009, 5:52 AM
Jay - this is looking like all Ext.Ajax.request get is converting a param of int 0 to blank. Is this really not a bug?

Do I need to handle this on the server side now? That sounds like bad practice to assume that blank = 0 on the back end.

EDIT - run this in FB :


Ext.Ajax.request({ url: '/blank', params: { foo: 0 }, method: 'GET' })

then inspect the params. foo = blank.

16 Apr 2009, 5:57 AM
agreed. I didn't look at it, wasn't too sure where the problem is. I would say that it is a bug.
test case:


Ext.Ajax.request({
url : 'index.html',
params : {
paramZero : 0,
paramOne : 1
}
});

16 Apr 2009, 5:57 AM
good find btw! :)

mschwartz
16 Apr 2009, 5:58 AM
I posted about this in another thread. The bug is actually in Ext.urlEncode. This code seems to fix the problem:



Ext.apply(Ext, {
urlEncode: function(o, pre) {
var buf = [],
key,
e = encodeURIComponent;

for (key in o) {
Ext.each((o[key] !== undefined) ? o[key] : key,
function(val, i) {
buf.push("&", e(key), "=", val != key ? e(val) : "");
});
}
if (!pre) {
buf.shift();
pre = "";
}
return pre + buf.join('');
}
});

TopKatz
16 Apr 2009, 6:00 AM
good find btw! :)

I cant take the credit. It was a combined effort by Mitz` and I in irc.

TopKatz
16 Apr 2009, 6:03 AM
I posted about this in another thread. The bug is actually in Ext.urlEncode. This code seems to fix the problem:



Ext.apply(Ext, {
urlEncode: function(o, pre) {
var buf = [],
key,
e = encodeURIComponent;

for (key in o) {
Ext.each((o[key] !== undefined) ? o[key] : key,
function(val, i) {
buf.push("&", e(key), "=", val != key ? e(val) : "");
});
}
if (!pre) {
buf.shift();
pre = "";
}
return pre + buf.join('');
}
});



This does the trick for me. Thanks

16 Apr 2009, 6:03 AM
I would move this thread, but I'm not an admin :(

Either way, i'm hoping a senior Ext developer will see this here.

Great work guys. thanks for taking the time to provide the feedback.

Condor
16 Apr 2009, 6:05 AM
No need, it's already reported (http://extjs.com/forum/showthread.php?p=317277#post317277).