PDA

View Full Version : Issue with Grid and CRUD



Jangla
12 Nov 2010, 9:59 AM
I'm implementing a grid and have made my first attempt at CRUD. I'm tantalisingly close to having it cracked but have stumbled across a problem.

I need to send the post to the server in much the same way as before I started down the CRUD root - so I need to send the id of the record and the changed field and value in the post params like so:

id : 707
status.label : 'Ready'
status.id : status.system.ready

so the post URL would be http://mydomain.com/api/update.json?id=707&status.label=Ready&status.id=status.system.ready

But what's getting sent now is something like this:

content {"status.label":"Ready","status.id":"status.system.ready","id":729}
days_filter 365
max 30
offset 0
sort publishDate

So the post URL is something like:

http://mydomain.com/api/update.json?content= {"status.label":"Ready","status.id":"status.system.ready","id":729}&max=30&offset=0&sort=publishDate&status=

As you can see, it's also sending the baseParams of the store which probably aren't needed for this operation.

So, can this be achieved with Ext? i.e. How can I send the same format of post params with a CRUD operation as I was doing before?

Jangla
15 Nov 2010, 3:55 AM
So I've made some progress on this - by defining the render function correctly I can now pass something that looks more like the post params. Only trouble is, if I have a field called status which is mapped in the store;



...
{name : 'status', mapping : 'status.id'},
...

.. then the param that gets passed to the render function is status.id and not status. Is there any way to set this up so only the name is passed and not the entire contents of the mapping? This becomes a bigger pain when there's an actual function in the mapping as the param name is the entire function converted to a string!

Ideally of course, this would need to be a dynamic function as I don't really want to have a massive code block working out what to do with each field.

Finally, and in a connected issue, I'm trying to udpate other fields and while the update call gets made, the little red triangle in the grid cell remains telling me it's not updated the grid. What can I hook into in order to commit that change?