Change the parameter key
Change the parameter key
sandberg75
Posts: 1Questions: 1Answers: 0
in Editor
Hi,
I have been using DataTables for a while (love it) and just started to work with Editor.
Im using a java framework called Stripes that binds parameters to the action bean, on the server side.
When I edit a row the parameters are sent like, key="data[firstname]", value="John".
Is it possible to specify/change the key?
I would like to get rid of the "data[ ]" part so that the value is automatically bound to my javavariable called "firstname", is that somehow possible?
This discussion has been closed.
Answers
Hi,
We discussed this by e-mail, but I'll post my reply here as well incase anyone else interested finds this post.
To remove the
data[]
part what you can do is make use of theajax.data
option of Editor which allows you to modify the data submitted to the server.For example you might have:
So what the function does is basically "flatten" the object.
$.extend()
is used to copy all the properties up to the top level and then the data object is simply deleted.Regards,
Allan