|
POST
|
Theme: Launchpad WabDev 2.7 I'm trying to implement what is found in THIS thread. I need to open a widget from the ScaleBar widget when the app loads. However, the var abc is getting set to undefined and not sure why. var widgetsConfig = this.appConfig.widgetPool.widgets;
var widgetId;
for (var i in widgetsConfig) {
if (widgetsConfig[i].name == "My Widget Name") {
widgetId = widgetsConfig[i].id;
break;
}
}
var abc = WidgetManager.getInstance().getWidgetsByName("AnchorBarController")[0]; //abc is getting set to undefined
debugger;
abc.setOpenedIds([widgetId]);
... View more
05-11-2018
08:59 AM
|
0
|
2
|
1203
|
|
POST
|
I'm getting "abc = undefined" when I run this and will not open the desired widget.
... View more
05-11-2018
08:44 AM
|
0
|
2
|
1741
|
|
POST
|
Dumb question: how do I add PanelManager as a reference to my ScaleBar widget? I'm attempting to open another widget at index (2) when the ScaleBar widget loads but getting "fail to startup widget Scalebar. ReferenceError: PanelManager is not defined" error.
... View more
05-11-2018
07:32 AM
|
0
|
1
|
1208
|
|
POST
|
I appreciate your input, Robert! And thanks for the tip/sample.
... View more
04-30-2018
12:15 PM
|
0
|
0
|
985
|
|
POST
|
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!
... View more
04-30-2018
11:55 AM
|
0
|
2
|
1051
|
|
POST
|
Re-mapping my thought process isn't going to be as easy as I thought. Thanks Ken!
... View more
04-27-2018
01:36 PM
|
0
|
0
|
918
|
|
POST
|
I'm having difficulty understanding and implementing the queryTask at startup of a widget. That is, I need to perform a queryTask and based upon the result.features.length use that value in a conditional statement to continue to load/startup the rest of the way. The problem is that queryTask.execute happens after the loading is completed and therefore my condition statement will never evaluate correctly. I know this because if you see where there are two console.log() statements, and print out in the console in this order: First -- console.log("2 workplanCheck value is: ", this.workplanCheckValue) Second -- console.log("1 workplanCheck value is: ", this.workplanCheckValue) So this means that ALWAYS my this.workplanCheckValue variable doesn't get set in time before the conditional statement is evaluated! constructor: function (args) {
lang.mixin(this, args);
window.map = this.map;
},
startup: function () {
////first, check to see if a workplan boundary exists
if (this.workplanId) {
var queryUrl = "https://somesite/rest/services/myservice/FeatureServer/0";
var queryTask = new QueryTask(queryUrl);
var query = new Query();
query.returnGeometry = true;
query.outFields = ['*']
query.where = "workplanId ='" + this.workplanId + "'";
debugger;
queryTask.execute(query, lang.hitch(this, function (result) {
this.workplanCheckValue = result.features.length;
console.log("1 workplanCheck value is: ", this.workplanCheckValue)
}));
}
//use the result.features.length value to evaluate a condition and load the rest of the widget
console.log("2 workplanCheck value is: ", this.workplanCheckValue)
if (this.workplanCheckValue > 0 ) {
this.beginWork_Workplan_ExistingBoundary();
}
else if (this.workplanCheckValue < 1) {
this.beginWork_Workplan_NoExistingBoundary();
}
},
//workplan exists, zoom to it and do other stuff
beginWork_Workplan_ExistingBoundary: function(){
...
},
//workplan doesn't exist, zoom to something else and do other stuff
beginWork_Workplan_NoExistingBoundary: function () {
...
},
... View more
04-27-2018
01:15 PM
|
0
|
2
|
974
|
|
POST
|
The reason why I thought it wasn't properly set is because I have this queryTask in the Startup: function() and it seems to not fire (deferred?) in the order I am expected. That is it will initially hit eh queryTask but then not actually execute and simply continue on thru until the startup finished then it will .exectute. For example, the first console print is: console.log("2 workplanCheck value is: ", this.workplanCheckValue) Then this: console.log("1 workplanCheck value is: ", this.workplanCheckValue) So what happens is my condition statements get evaluated first before I can set the this.workplanCheckValue variable to the result of the queryTask. constructor: function (args) {
lang.mixin(this, args);
window.map = this.map;
},
startup: function () {
////first, check to see if a workplan boundary exists
if (this.workplanId) {
var queryUrl = "https://somesite/rest/services/myservice/FeatureServer/0";
var queryTask = new QueryTask(queryUrl);
var query = new Query();
query.returnGeometry = true;
query.outFields = ['*']
query.where = "workplanId ='" + this.workplanId + "'";
debugger;
queryTask.execute(query, lang.hitch(this, function (result) {
debugger;
this.workplanCheckValue = result.features.length;
console.log("1 workplanCheck value is: ", this.workplanCheckValue)
}));
}
console.log("2 workplanCheck value is: ", this.workplanCheckValue)
//debugger;
if (this.editLayer == 'WP' && this.reviewStatus == 'Draft Mode' && this.workplanCheckValue > 0 ) {
this.beginWork_Workplan_ExistingBoundary();
}
else if (this.editLayer == 'WP' && this.reviewStatus == 'Draft Mode' && this.workplanCheckValue < 1) {
this.beginWork_Workplan_NoExistingBoundary();
}
},
... View more
04-27-2018
12:12 PM
|
0
|
0
|
644
|
|
POST
|
Sorry, that was my fault again. I was stepping thru the debugger. Your code works perfectly of course! Thanks again for your assist and lesson.
... View more
04-27-2018
11:21 AM
|
0
|
0
|
644
|
|
POST
|
Sorry -- I was too slow. I updated my last reply. That other error was due to query.outFields = ['*']
... View more
04-27-2018
09:54 AM
|
0
|
0
|
3240
|
|
POST
|
Now it leads me to a "TypeError: g.join is not a function"? Something new. <-- this appears to be because my query.outFields not correctly set as an array. However, I'm still getting the same error on my original code: ////first, check to see if a workplan boundary exists
if (this.workplanId) {
var queryUrl = "https://somesite/rest/services/myservice/FeatureServer/0";
var queryTask = new QueryTask(queryUrl);
var query = new Query();
query.returnGeometry = true;
query.outFields = ['*']
query.where = "workplanId ='" + this.workplanId + "'";
debugger;
queryTask.execute(query).then(lang.hitch(this, function (result) {
debugger;
this.workplanCheckValue = result.features.length;
console.log("workplanCheck value is: ", this.workplanCheckValue)
}));
}
console.log("workplanCheck value is: ", this.workplanCheckValue) Thanks again for your explanation!
... View more
04-27-2018
09:50 AM
|
0
|
8
|
3240
|
|
POST
|
I'm struggling on this whole concept for some reason. It's just not registering how to apply and where -- my failed attempt: queryTask.execute(query).then(lang.hitch(function (result) {
this.workplanCheckValue = result.features.length;
}));
... View more
04-27-2018
09:39 AM
|
0
|
10
|
3240
|
|
POST
|
I'm getting a ReferenceError "results is not defined" on the queryTask.execute: //first, check to see if a workplan boundary exists
if (this.workplanId) {
var queryUrl = "https://somewebsite/someagssite/rest/services/folder/servicename/FeatureServer/0"
var queryTask = new QueryTask(queryUrl);
var query = new Query();
query.returnGeometry = true;
query.where = "workplanId ='" + this.workplanId + "'";
debugger;
queryTask.execute(query).then(function (results) {
this.workplanCheckValue = results.features.length;
});
}
console.log("workplanCheck value is: ", this.workplanCheckValue) I need to set this.workplanCheckValue to the number of features returned from the queryTask. Any assistance appreciated!
... View more
04-27-2018
09:06 AM
|
0
|
12
|
4071
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 1 | 10-25-2022 11:46 AM | |
| 1 | 08-08-2022 01:40 PM | |
| 1 | 02-15-2019 08:21 AM | |
| 2 | 08-14-2023 07:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|