Adding a changing value to the payload to the server
Adding a changing value to the payload to the server

I have a screen with 2 Datatables. You like on a row on the top one, and it populates the table below with objects from another service on the bottom table. It's the bottom table that I have an Editor on.
Each of these rows in the bottom has a unique ID (from the server-side database). When I edit a row, it's works fine. When I try to do a New row, it doesn't know what the object from the stop I'm adding it to (i.e. the top ID). I do keep that ID as a "state" variable but the Editor doesn't seem to re-read it.
var state_id = -1;
var editor = ..... {
ajax {
url: '/api/editor/id/',
type: 'POST',
data: function(d){
d.thing_id= state_id
};
....
The state_id
does change when I click it (because I use it in other places) but when the Editor sends it, it always sends it as -1
, the value it was initially. But I want it to change every time!
I am not married to this solution but the overall question is -- I need that thing_id to be sent with my API to the server.
anyone have ideas?
Answers
We'd really need a link to your page, or at least the code you are using. It sounds like you might be doing something like in this blog post but I'm not certain.
Allan