PDA

View Full Version : [CLOSED][3.0.0] JsonReader with non-array response



steffenk
17 Jul 2009, 2:40 PM
Hi,

i struggled a while how to get the data correct in my store, when json response isn't an array but only one object.
After searching i found a slight modification from Condor
JsonReader should be able to process a root that isn't an array, but only a single record object, e.g.
in this thread:
http://extjs.com/forum/showthread.php?p=259974#post259974

the only change is:

if(!Ext.isArray(root)){
root = [root];
}


real life example is the user profile from twitter, eg
http://twitter.com/users/show.json?screen_name=a2

This would be great if it could be implemented.

btw - i think it's not very handy to have no "hook" for preprocessing the raw data, instead i'm forced to override the complete method, which is overhead.

evant
17 Jul 2009, 7:05 PM
This isn't a bug. It's quite clear in the documentation that the reader expects an array of records to be returned. Marking this as closed.

Condor
17 Jul 2009, 10:28 PM
This would however be a very useful feature request (although I think it already exists).

Animal
18 Jul 2009, 12:26 AM
Still a few more events needed to be able to poke in functionality at important places...

http://extjs.com/forum/showthread.php?t=37625

Preprocessing returned data is a basic requirement.

steffenk
18 Jul 2009, 1:09 AM
Preprocessing returned data is a basic requirement.

i absolutely sign that! Any chance to get an event after loading raw data?

Animal
18 Jul 2009, 2:08 AM
Get in at the HttProxy level: http://extjs.com/forum/showthread.php?p=176802#post176802

steffenk
18 Jul 2009, 2:19 AM
seems that you fight for those events some longer time now. What is the reason for "ignoring" this?
In TYPO3 "hook-request" is one of the most accepted and quick integrated things - it's what users need.

steffenk
20 Jul 2009, 1:28 AM
Hi again,

i'm still not pleasured. Argument "Doc state that ..." isn't the right argument imho.
Looking to source i also see something like this in the execute method:


if (this.writer.listful === true && this.restful !== true) {
rs = (Ext.isArray(rs)) ? rs : [rs];
}
so there is this conversion for writer, i ask why not for the reader?

And the event for raw data is still a valid request.