I use the connector and dataprocessor for a treegrid. When I move an item with some children, the following happens in the database:
- New parent is added
- New children are added
- Old parent will be deleted
- Old children will NOT be deleted
How to overcome this problem?
You can assign custom code to BeforeDelete server side event and call from it any kind of custom code, which will handle child items in the old branch ( action object, incoming parameter of event handler, will contain id of old branch item )
Of course, thanx!
function beforeDelete( $data ) {
// Delete all children before deleting the actual item
removeChildren( $data->get_value('id') );
};
$conn->event->attach( 'beforeDelete' , 'beforeDelete' );