idSrc not working?
idSrc not working?
snunn
Posts: 17Questions: 5Answers: 0
I am trying to use: idSrc: "idEntity" on the Editor. Whenever I edit a row, and hit submit the id is not being set as shown in the documentation. I can see: action=edit&data...etc, but never see the identity or id field being passed.
This discussion has been closed.
Answers
Same here, I am using a web service connected to a db with two forien keys forming a composite key. But I can't seem to define the edit/remove functions because it always kicks back an error:
https://datatables.net/manual/tech-notes/14
Here is what I have tried:
All I have is: idSrc: 'idEntity',
I decided to work around this issue for now. I ended up putting my key in the editor as a hidden field. Then I added the following code:
This resulted in a field called identity being passed along with the action, and data fields. Works for now.
The ID isn't submitted as a field, but rather it is submitted as part of the parameter name. For example, your client-side might submit the following on edit:
In this case
row_29
is the id.Allan
Allan,
Thanks for the note, that is what I noticed when I was debugging. However, it makes it hard to quickly get parameters on the server since the "parameter name" becomes request unique since there is a changing key in the parameter name. For example, I am trying to get the parameter using the session object via server side javascript such as:
return $exchange.request().getParameter("data["+keyId+ "]["+keyName+"]");
However, since the key wasn't passed separately, I would have had to parse it out of one of the parameters that was posted up in the body. So, for my case, having the key also passed allows me to quickly get the parameter without much difficulty for a single row update.