WAB - prevent in panel widget openAtStart on mobile

162
1
Jump to solution
10-10-2019 01:02 PM
MaximeDemers
Occasional Contributor III

Hello,

I would like to disable the openAtStart config for a in panel widget on mobile device. I know in config.json there is a mobileLayout section but it seems to not work for widget that are in a widgetPool.

This the part of my config.json where the widget is defined:

"widgetPool": {
    "panel": {
      "uri": "themes/LaunchpadTheme/panels/LaunchpadPanel/Panel",
      "position": {
        "relativeTo": "map"
      }
    },
    "widgets": [
      {
        "name": "LayerList",
        "version": "2.13",
        "uri": "widgets/LayerList/Widget",
        "config": "configs/LayerList/config_widgets_LayerList_Widget_41.json",
        "index": 1,
        "id": "widgets_LayerList_Widget_41",
        "label": "Liste de toutes les couches",
        "openAtStart": true
      }
  ]
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I know I could modify the widget.js to close it automatically if jimuUtils.inMobilieSize(), but that's not what I am trying to achieve. I would like to prevent the openAtStart completely.

Thank you!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Maxime,

  I only did limited testing but if you make this change to the BaseLayoutManager.js. It worked for me.

      if(!this.openAtStartWidget && widgetConfig.openAtStart){
        if(!jimuUtils.inMobileSize()){
          iconDijit.switchToOpen();
          this.openAtStartWidget = widgetConfig.name;
        }
      }

View solution in original post

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Esteemed Contributor

Maxime,

  I only did limited testing but if you make this change to the BaseLayoutManager.js. It worked for me.

      if(!this.openAtStartWidget && widgetConfig.openAtStart){
        if(!jimuUtils.inMobileSize()){
          iconDijit.switchToOpen();
          this.openAtStartWidget = widgetConfig.name;
        }
      }
0 Kudos