I tried to implement a formatter to set a button visible if two model variables are true so I used the parent model object as path for the formatter like:
<Button text="Button" visible="{path: 'myModel>/uiSwitches', type: 'sap.ui.model.type.Boolean', formatter: '.checkIfVisibleFormatter'}" />
My formatter looks something like this:
checkIfVisibleFormatter: function(uiSwitches) {
return uiSwitches.switch1 && uiSwitches.switch2;
}
Now when changing the models value(switch1 or switch2) through getModel() and setData() the formatter is not called and the button is still in/visible.
...
let myModel = this.getOwnerComponent().getModel("myModel");
let myData = myModel.getData();
myData.uiSwitches.switch1 = false;
myModel.setData(myData);
...
If I reference one of these model flags directly inside the button the ui at least refreshes on changes to this one.
<Button text="Button {myModel>/uiSwitches/switch1}" visible="{path: 'myModel>/uiSwitches', type: 'sap.ui.model.type.Boolean', formatter: '.checkIfVisibleFormatter'}" />
How would I make sure the formatter gets called everytime something inside uiSwitches changes?