VisibleBinding dependant on two fields?

Posted on
Sun Oct 06, 2019 10:25 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

VisibleBinding dependant on two fields?

I seem to recall this might have been answered before but can't find it?

In a plugin's devices.xml, I have a group of fields whose visibility is enabled if checkbox A field is enabled. So far so good. :)

In the group of fields that are now visible, I want the fields in this group to be hidden or visible dependant on another checkbox B. However regardless of the setting of this check box B, the fields should not be visible if the checkbox A field is not enabled.

Is this possible as I haven't been able to get my thoughts around how this could be achieved. :)

Posted on
Sun Oct 06, 2019 10:52 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: VisibleBinding dependant on two fields?

I have a work-around which isn't ideal but will achieve a similar effect which is to use enabledBindingId as well. The fields will be visible but greyed out. :)

Posted on
Sun Oct 06, 2019 12:50 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: VisibleBinding dependant on two fields?

No way to easily do this currently. Besides your workaround, one technique I often use is to have an always-hidden checkbox controls that I use just as a visibleBindingId for controls, then I manage that control's on/off state manually based on what UI I want to be visisble. Here is an example (which is in JSON instead of the normal XML):

Code: Select all
{   "@type": "checkbox",         "@id": "zwShowMainUI", "@defaultValue": false, "@hidden": true            },
{   "@type": "checkbox",         "@id": "zwShowPollingUI", "@defaultValue": false, "@hidden": true         },
{   "@type": "checkbox",         "@id": "zwShowWakeIntervalUI", "@defaultValue": false, "@hidden": true      },
{   "@type": "checkbox",         "@id": "zwShowDumpDevToLog", "@defaultValue": false, "@hidden": true   },
{   "@type": "checkbox",         "@id": "zwShowSubmitModelInfoUI", "@defaultValue": false, "@hidden": true   },
{   "@type": "checkbox",         "@id": "zwShowManualModifyConfigParmUI", "@defaultValue": false, "@hidden": true   }

Image

Posted on
Sun Oct 06, 2019 1:08 pm
kw123 offline
User avatar
Posts: 8360
Joined: May 12, 2013
Location: Dallas, TX

Re: VisibleBinding dependant on two fields?

I my bigger plugins I have a hidden checkbox for almost each field. Then set that check box in the plugin accordingly.

But it has the limitation that you need to have a callback that can set that.

There is a new option of a callback that indigo calls every x secs but I have not tried that. On my todo.




Sent from my iPhone using Tapatalk

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests

cron