Disable a widget when site is accessed by phone or tablet?

1268
3
12-06-2016 01:52 PM
RyanNosek
Occasional Contributor II

Looking for a way or suggestions on how to disable a widget if viewed on a mobile device or tablet. Thought I'd check with the community if a) anyone has done this and/or b) if this would be useful to anyone else? Thanks,

Web AppBuilder Custom Widgets

Web AppBuilder for ArcGIS

web appbuilder2.2‌

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Ryan,

   Depending on if this widget is inside a controller widget (i.e Header controller widget) or an onscreen widget determines how difficult this will be. I have helped another poster in the past hide widgets based on the user logged in (their authorization to access the widget).

How can I toggle the visibility of a widget?  

RyanNosek
Occasional Contributor II

Robert - Thanks for including that link, that could definitely come in handy later on. 

At this very preliminary point, I'd say the widget needing hidden on layout change could be either in the controller header or an onscreen - which ever is the path of least resistance. 

My handle on Dojo/JavaScript is not as good as I'd like it to be, and as far as solutions go for hiding a widget in a mobile/tablet layout all I can really think of are CSS media queries. Any guidance is very much appreciated.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ryan,

   I totally forgot that this is way easier than it use to be in the main config.json there is a mobileLayout property and in that object it lists all the widget you want to use from mobile. So all you have to do is remove that widget from that section of the config and you are good to go.