Jedit and Json
Jedit and Json
Hi i'm using a setup where i'm getting all my data using Ajax calls and Json return the data to be inserted in the table.
Im now looking to be able to use jedit also in the table, and my problem is that i can send the variables value that is the value in the td, but jedit also send the td:s id as an identifier, but as im using ajax and json to get tha data from my DB i would need to also send a id variable with the json return, to be inserted in the table as the corresponding td id. Is there an easy way to do this?
Im now looking to be able to use jedit also in the table, and my problem is that i can send the variables value that is the value in the td, but jedit also send the td:s id as an identifier, but as im using ajax and json to get tha data from my DB i would need to also send a id variable with the json return, to be inserted in the table as the corresponding td id. Is there an easy way to do this?
This discussion has been closed.
Replies
What you need to do, as you have noted, is to get an ID which can be used by the server-side process to update the target row. So to do this you need to instruct jEditable where to find this value. There are a number of discussions in this forum about exactly this issue, but given that there is this thread and one just two or there below it about this topic I think it's probably best if I update my example to show how this might be done with jEditable, which I have now done: http://datatables.net/examples/api/editable.html
Hope this helps,
Allan
When i now get the Json result, and insert the data into Datatables, it autogenerates the table for me, and i would like that i culd send a specific id for every td.
In that case I see a couple of options:
1. Modify the return to have a unique ID in the row (a hidden column possibly) - this combined with the column number will give you the location required.
2. Have a hidden id in each cell - which is also returned with the json
3. Modify the table after DataTables has rendered it with the IDs required.
There are other ways to do it as well - basically all you need to do is get the unique ID, and how you do it will depend on your setup and preferences.
Regards,
Allan