Updating multiple rows when a parent is updated

Updating multiple rows when a parent is updated

cory.zimmermancory.zimmerman Posts: 2Questions: 1Answers: 0

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?

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    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

  • cory.zimmermancory.zimmerman Posts: 2Questions: 1Answers: 0
    edited September 2014

    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.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    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

This discussion has been closed.