Edit cell values with JavaScript, push the values to array and reapply them on reload

Edit cell values with JavaScript, push the values to array and reapply them on reload

nickpapoutsisnickpapoutsis Posts: 10Questions: 2Answers: 0

Hi all,

Example here: http://live.datatables.net/sabiluju/3/edit

Since I can't afford the Editor right now I'm trying to add some extremely basic editing functionality to DataTables.

I have used X-editable and am able to inline edit the cell data I want but that's where I'm stuck.

Table data comes from a JS object, the Custom Input column is empty initially.

When editing a Custom Input cell I want the data to be pushed to an object/array in a "id: custom_input" kind of way and then outputted to the textarea.

(At this point I save the textarea contents to a file/database that's not present in the example).

Then, when the page reloads (and the textarea is already populated with data) I want the data from the textarea ("id: custom_input") to be used to update the table (if an id from the textarea is found in the table update the corresponding custom_input cell).

I have managed to get the first part to kinda work using the API but it's extremely hacky and I hate it. No progress on the second part yet.

I was wondering if anyone has a working solution or can point me to the right direction.

Thanks!

This discussion has been closed.