Hi,
I need to know the best way to show, edit & delete line items of an employee's salary components in a tab next to employee
tab. I have an employee
controller, its view & actions and also an employee components
controller, view and edit action coded. I would like to show the employee components
(line items of employee
) in a bootstrap tab adjacent to the employee
tab. There is a one to many relation between employee
& employee components
.
My question, if I understand correctly I should get all related records of an employee, i.e. components, and store them in an array. Show them in the components
tab. What happens when the user edits them or deletes some of them. Should I let that be independently handled by the components
controller or should I handle that in employee
controller. When the data is saved I would like all master data (employee) and line items (employee components) be saved together in a single commit. I read on this forum that its bad design to have multiple controllers managing a single web page, i.e. calling action of components
controller from employee
controller .
The issue is how to implement delete
. Edits can be saved from the POST array but what about deletes
. If I use a separate controller, view, action code for the components
then only deletes
can be committed immediately. Can I let the component
tab be independently managed by its controller or is that a bad idea. I will have more such tabs with more 1-many relations in future.
Amal