bulk edit without user interaction
bulk edit without user interaction
Hello, here I am again
How do I trigger multiple row updates, after a user has changed a row?
I have some rows which are linked by a column, let's call it sub_id
.
if a user updates a field name
with the bubble or form editor (multiple fields), I want editor to update that field (fields) in all rows with the same value in sub_id
without the user having to do anything.
how would i achieve that? I am using php server side, if that matters
This question has an accepted answers - jump to answer
Answers
I assume you are also using the Editor PHP libraries.
If so, just use SQL and Editor's db handler on "validatedEdit" (meaning: the editing can't go wrong any longer.) You could also use "postEdit", I guess. This will work provided you are submitting all values to the server in case you are editing a row. This is the default for "main" but not for "bubble" editing.
https://editor.datatables.net/reference/option/formOptions
Hi rf1234,
thank you for that idea, but I am looking for a client-side solution.
doing it server-side bypasses all the
formatters
and I have to trigger ajax.reload() on the whole table after each edit, to get the rows updated.Also I cannot use the editor db handler, because I don't know in advance, which and how many fields are updated.
It's working with a 'validateEdit' function, but it's messy and I hope, there is a 'cleaner' way of updating the corresponding rows
The cleanest way would be to adjust your data model I suppose. "name" shouldn't be saved redundantly but just once. That would be a solution not requiring a client side update. A simple ajax.reload after updating "name" once would do the job.
If you do client side manipulations without updating / reloading the values from the server this may become very "messy", I guess.
You are right, the data should not be shared across several rows, but I need that row to be displayed up to 5 times (depending on start and end date) with only the start date being different
I do not want to manipulate the data client side.
If a field on a row gets updated, what I want to do client side is looking for rows with the same
sub_id
and then aneditor.edit()
should be triggered with the values from the edited row for every row with the samesub_id
.Is that possible?
Something like this could work but it isn't "simple" but rather "messy" I guess.
It requires global variables to check what has changed. You also need to distinguish whether a successful submission was "manual" or "automatic". It has to be sure that the "opened" event will not be triggered when submitting automatically without showing the form etc.
Hi rf1234,
sorry for my late response. I was not able to work on my project for a while.
Thank you very much for your solution! It works like a charm and is (with some minor adjustments) exactly, what I was looking for.