Select to view content in your preferred language

Startup Widget From Conditional Logic

409
2
Jump to solution
04-30-2018 11:55 AM
JamesCrandall
MVP Frequent Contributor

WAB Developer 2.7

Launchpad Theme

Requirement: onOpen of a Web AppBuilder app that contains two or more custom widgets, open a specific widget based upon a url parameter of the deployed WAB.

I'm looking for some design/architecture guidance.  We know how to acquire url parameters and their values so this is more of an attempt to understand where we would want to put logic to open specific widget based upon the value of that url parameter. 

One idea is to have a "startup" widget whose sole existence is to get the url parameter value and open the other widget using the required logic. (ie. if &urlParamTodo=X then open widget 1, else if &urlParamTodo=Y then open widget 2, else if &urlParamTodo=Z then open widget 3).  This seems like the least disruptive approach and could alleviate the need to alter the framework.

But maybe there's an even better way.  Any comments or ideas?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

James,

   That is absolutely the route to go when you are looking to not alter any of the core files like the MapManager.js or ConfigManager.js. You would create an inPanel false widget like the scalebar widget have it get the url parameter like this

var myObject = jimuUtils.urlToObject(window.location.href).query || {};
if (myObject.esearch) {
  if(myObject.esearch === "last48"){
    //do something
  }
}

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

James,

   That is absolutely the route to go when you are looking to not alter any of the core files like the MapManager.js or ConfigManager.js. You would create an inPanel false widget like the scalebar widget have it get the url parameter like this

var myObject = jimuUtils.urlToObject(window.location.href).query || {};
if (myObject.esearch) {
  if(myObject.esearch === "last48"){
    //do something
  }
}
JamesCrandall
MVP Frequent Contributor

I appreciate your input, Robert!  And thanks for the tip/sample.

0 Kudos