I have View-A that opens a popup on two different events, each event passing a different value to the popup parameter, p1.
If I click a button, I pass value of 0 (zero). If I click on a table row, I pass a value from the table, for example 100.
I would like to enable certain components if the value is 0, and disable them if greater than 0. I have been attempting to use the popup view's onStartup
event to check the value of p1
, but that gives varying results. Code from this event:
def runAction(self):
self.getChild("root").getChild("TabContainer").props.currentTabIndex = 0
if self.params.p1 == 0:
self.getChild("root").getChild("TabContainer").getChild("flx_General").custom.enable_comp = True
else:
self.getChild("root").getChild("TabContainer").getChild("flx_General").custom.enable_comp = False
The components enabled prop are bound to this: custom.enable_comp
.
The components seem to alternate enable/disable every couple of clicks on the button, and the same thing with clicking on a table row. So I get inconsistent results. Is the popup view actually firing the start up event every time the popup opens? If so, it seems as if it remembers the previous value, like in a cache or something, ( I have a label bound to p1
so I can see what the value really is and if the components should be enabled or not). If the event does not fire every time the popup opens, then we should fix that :).
The idea is to use the same popup for adding records or viewing an existing record.
I've also tried using the start up event of a nested flex container that specifically holds those components, which is mentioned in the code above as flx_General
. And as you can see, there are other tabs with more components that I would also like to do the same. But perhaps I am going about this the wrong way?
What should I look at or change?
Thanks