1. Select Record – adopts the row into a to a model SelectedAccounts
2. Deselect Record – removes rows from model SelectedAccounts
The problem I am having is that the Select Record is working, but he Deselect Record does not work. So, if I select record 1, 2 and 3. They are added to the SelectedAccounts model. But if I deselect 1, 2 and 3 they are not removed from the model. But, if I deselect 4, then then 1, 2, 3 and 4 are removed from the model. What am I doing wrong???
The issue sounds like the Deselect Option doesn’t have the right context, since the action is on a different model than the one you’re trying to remove from.
It’s a little roundabout, but to accomplish this you could do something like this with the remove row action…
Updates a Feld on a UI-Only Model and stores the AccountId
Toggles a checkbox in SelectedAccounts Model (ui-checkbox)
Then that SelectedAccounts model is set up with…
3. SelectedAccounts Model has a Model Action when Row Updated w/ field ui-checkbox
4. That Model Action starts with a branch thats {{$Model.UI-Only-Model.data.0.AccountId}} == {{Id}} (If the Id matches the record you said you want to remove)
5. If true, remove row in context
6. If false, do nothing
Thanks for your help. I think I did everything you said, but if I have a list of 10 accounts and select records 5 & 6. Then deselect 6, the checkbox on the appropriate SelectedAccount record is checked, but the Ui-Only AccountID is that of record 1. It is not the ID of record 6. So record 6 is not removed from the SelectedAccount model.