Problems modeling data with Editor
Problems modeling data with Editor
Lucho_1312
Posts: 30Questions: 9Answers: 0
Hi!
I'm using Editor in my dataTable, and I'm trying to use it with a REST API in a NodeJS server.
The problem is that I need the data in this way:
{
"name": "newValue"
}
but Editor gives me the data like this:
{
"action": "edit",
"data": {
"row_2": {
"name": "newValue"
}
}
}
Is there anyway to model that data before the submit?
I found the presubmit event, but I don't know how to used and I couldn't find any suitable example :(
Thanks!
Luciano
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Ok, so I did this, but it doesn't work :(
My REST API only supports editing one row at a time, so I simplify my data. Also, I'm trying to replace all the information with a new object that has all the data as I need it.
The problem is that the posted data is the same as before. If I add parameters, everything works perfect, but when I try to replace the
data
object, my luck is gonne :(Any ideas?
Thanks!
So I finally did it. I don't know if it's the best way, but it worked...
The only problem I have now, and that I'll like to solve is this:
How can I post ONLY ONE row in the 'data.data' object?
I want to avoid the need to check for the first element in the for and then do a break.
Thanks!
Luciano
You could enable the
legacyAjax
option which is limited to a single row only. This page documents the legacy data format that Editor used.Allan
THANKS!
It worked perfectly, now I can remove my little "hack" :D