Updating multiple rows when a parent is updated
Updating multiple rows when a parent is updated
cory.zimmerman
Posts: 2Questions: 1Answers: 0
in Editor
I have a table that shows records that have parent records. So, one column would be 'name', another could be 'parent.name'.
Multiple records could have the same parent, so if I update 'parent.name', I'd like the change to be reflected on all of the rows that have that parent. Has anyone ever done something like this before?
This discussion has been closed.
Answers
The Editor PHP libraries don't provide an option for this at the moment. You would need to check the data being sent from the client and then perform a manual update.
Having said that, an SQL schema with a join would make this problem "go away". An update to the master record would be reflected in all joined information, since the master would be read. Is that not possible in this case?
Allan
This is in a rails project :)
The problem is wanting to update two or more DataTable rows at once, while editing only one. I'll look in to writing something that can do it, maybe if I send along the DT_RowIDs of the rows that need updating? I'll keep you posted.
Yes, sending both IDs so you can operate on them sounds like a good idea. You could potentially use
ajax.data
to send the extra information.Allan