OK, so here was the issue.
In the Todos tutorial Chapter 7 they have you add a method to handle the server
response.
didFetchTasks: function(response, store, query) {
if(SC.ok(response)) {
store.loadRecords(Todos.Task,
response.get('body').content);
store.dataSourceDidFetchQuery(query);
} else store.dataSourceDidErrorQuery(query, response);
},
If you are using ERRest's JSON formatter you don't need the .content . I
thought that was a call to a function but it turns out that is just an
attribute that it anticipates.
i.e.
{ "content" : [{"type":"Task","description":"Build my first SproutCore
app","guid":"task-1","isDone":false},{"type":"Task","description":"Build a
really awesome SproutCore
app","guid":"task-2","isDone":false},{"type":"Task","description":"Next, the
world!","guid":"task-3","isDone":false},{"type":"Task","description":"Integrate
with ERRest","guid":"task-4","isDone":false}]}
If you are using ERRest's SproutCore formatter in place of using .content you
should use .records
i.e here is the .sc response:
{"records":[{"type":"Task","description":"Build my first SproutCore
app","guid":"task-1","is_done":false},{"type":"Task","description":"Build a
really awesome SproutCore
app","guid":"task-2","is_done":false},{"type":"Task","description":"Next, the
world!","guid":"task-3","is_done":false},{"type":"Task","description":"Integrate
with
ERRest","guid":"task-4","is_done":false}],"ids":[null,null,null,null],"count":4}
If you'd like me to fill out the tutorial just let me know,
Johnny
On May 25, 2010, at 3:20 PM, Pascal Robert wrote:
> I don't have an answer for you, but if you get it working, please update this
> page :-)
>
>
> http://wiki.objectstyle.org/confluence/display/WONDER/SpoutCore+and+ERRest
>
>> Hi,
>>
>> I'm trying to work through the sample sproutcore application found here:
>> http://wiki.sproutcore.com/Todos%C2%A0Intro
>>
>> In place of the backends they recommend I'm trying to hook it up to ERRest.
>> I've created the POJO for the object they want us to use and ERRest is
>> vending the JSON. I can see from the sc-server log that it successfully
>> requests the data but it doesn't get loaded into the application.
>>
>> Has anyone else worked through the example SproutCore app and if so can you
>> give me a pointer?
>>
>> Thanks in advance,
>>
>> Johnny Miller
>> Kahalawai Media Corp
>> http://www.kahalawai.com
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca
>>
>> This email sent to [email protected]
>
Johnny Miller
Kahalawai Media Corp
http://www.kahalawai.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]