PDA

View Full Version : DirectProxy sending no data on update. Looking at 'jsonData'?



shousper
18 Apr 2011, 4:47 PM
Hi,

I'm trying to get an EditorGridPanel working with the DirectProxy to load, create and update records in a fairly simple grid. It's using metadata loaded from the server response to build the column model after the store is loaded and a few other tricks here and there, but I've got it all working up until saving changes.

Now, it's not using restful services, but I have got the api configuration working properly - which I've confirmed by stepping through the js in Chrome. However, I found that when the record is being saved, the doRequest() function of DirectProxy is looking for data in 'jsonData', when my data is in a property named 'rows'. As per the server-supplied/JSONReader metadata.

I've had a look around the forums and a quick Google and not come up with much as yet, apart from a few solutions involving overriding functions.

It seems someone else has found this problem in version 3.1.1 (http://www.sencha.com/forum/showthread.php?94648-SOLVED-3.1.1-restful-paging-directStore-no-data-in-POST&highlight=editorgridpanel+directstore+update+data), but solved it by modifying their code to work with ExtJS.

However, I'm a bit confused.. Is this a bug?

I found another post referencing version 3.0 RC1.1 (http://www.sencha.com/forum/showthread.php?69415-3.0-RC1.1-DirectStore.api.save-request-params-Question&highlight=editorgridpanel+directstore+update+data) which has different code to that found in my copy of the 3.3.1 release. And after downloading a fresh copy, I found the same code.

I kept looking, but nobody has any explanation why this was changed back to point directly at 'jsonData'. So am I doing something severely wrong? Or is this indeed a bug?

Sorry for the overly verbose post, but I wanted to be clear. This is fairly important to my project also.

Thanks in advance for any feedback!

EDIT:

And so setting encode to false on the JsonWriter managed to make it work? How does that work?!