POST
|
I am trying to utilize PanelManager in my WAB widget. My WAB version is very old (1.2). I am trying to add it as follows: define([ //dojo AMD modules ... //dojox AMD modules .. //dGrid AMD modules ... //dijit AMD modules ... //esri AMD modules ... //jimu web appbuilder AMD modules 'jimu/BaseWidget', 'jimu/utils', 'jimu/WidgetManager' 'jimu/ PanelManager ' ], function ( //dojo AMD modules ... //dojox AMD modules ... //dgrid AMD modules ... //dijit AMD modules ... //esri AMD modules ... //jimu web appbuilder AMD modules BaseWidget, utils, ... WidgetManager PanelManager ) { // Code goes her Notice that there are spaces when I add 'jimu/ PanelManager '. This is exactly the way the documentation has it, but when I try to launch my app, it doesn't load because it is incorrect. When I change it to 'jimu/PanelManager' (with spaces removes it loads, but when I try to create an instance variable (see below), I get the error: "Uncaught ReferenceError: PanelManager is not defined". What am I doing wrong here? wm.loadWidget(myWidget); wm.openWidget(myWidget); var pm = PanelManager.getInstance(); pm.showPanel(myWidget);
... View more
03-20-2020
07:57 AM
|
0
|
4
|
770
|
POST
|
OK, I ran the following: editButton.on('click', lang.hitch(this, function () { editButton.setDisabled(true); //disable the edit button on first click var wm = WidgetManager.getInstance() var tm = wm.appConfig.widgetPool.widgets[8]; var tmWidget = wm.openWidget(tm.id); })); It ran, but nothing happened. No errors were thrown, but the TaskManager widget never opened either. Do I need to use something like PanelManager? I tried this, but I keep getting "PanelManager undefined" error. editButton.on('click', lang.hitch(this, function () { editButton.setDisabled(true); //disable the edit button on first click var wm = WidgetManager.getInstance() var tm = wm.appConfig.widgetPool.widgets[8]; var tmWidget = wm.openWidget(tm.id); var pm = PanelManager.getInstance(); pm.showPanel(tmWidget); })); I added PanelManager under my requires at the top, but there is something skrewy with the documentation (its says to add "jimu/ PanelManager ", with a space before and after PanelManager. This breaks my code and the app won't load). Could I use `wm.loadWidget()` somehow instead?
... View more
03-20-2020
07:04 AM
|
0
|
1
|
706
|
POST
|
Hey Robert - I ran "wabVersion" in the console and it is indeed 1.2. I basically am tasked with making enhancements to this very old WAB app; this is why I have probably found the documentation confusing in so many instances (not just this one). Anyways, the below code almost worked. It went through the wm.openWidget(tm.id) and kicked over to the TaskManager widget.js onOpen function. It then kicked back to the InfoTemplate widget in the ".then" part and failed due to "Uncaught TypeError: Cannot read property '.then' of undefined." var editButton = new Button({ label: "Edit Schedule" }); editButton.on('click', lang.hitch(this, function () { editButton.setDisabled(true); //disable the edit button on first click var wm = WidgetManager.getInstance() var tm = wm.appConfig.widgetPool.widgets[8]; wm.openWidget(tm.id) .then(lang.hitch(this, function (tmWidget) { console.log("Yo") //now you have a refernce to the Task Manager widget using tmWidget var })); }));
... View more
03-20-2020
05:28 AM
|
0
|
1
|
706
|
POST
|
1.2, I believe. BTW -When I go to the documentation for WidgetManger, there is no `.triggerWidgetOpen' method, only an `.openWidget(widget)` method. In the console when I am debugging, I was able to use var wm = WidgetManager.getInstance(); var tm = wm.appConfig.widgetPool.widgets[8]; to find the TaskManager widget: tm >uri: "widgets/TaskManager/Widget", version: "1.2", id: "widgets/TaskManager/Widget_26", name: "TaskManager", label: "Task Manager", …} I then tried using this to open the TaskManager widget, but nothing happens: wm.openWidget(tm);
... View more
03-19-2020
01:36 PM
|
0
|
1
|
732
|
POST
|
Here's how I have it defined; do you see a problem here?: define([ //dojo AMD modules ... //esri AMD modules ... //jimu web appbuilder AMD modules 'jimu/BaseWidget', 'jimu/utils', 'jimu/portalUtils', 'jimu/dijit/Message', 'jimu/MapManager', 'jimu/tokenUtils', 'jimu/portalUtils', 'jimu/LayerInfos/LayerInfos', 'jimu/PoolControllerMixin', 'jimu/WidgetManager' ], function ( //dojo AMD modules ... //esri AMD modules ...//jimu web appbuilder AMD modules BaseWidget, utils, PortalUtils, Message, MapManager, tokenUtils, portalUtils, LayerInfos, PoolControllerMixin, WidgetManager ) { // My code...
... View more
03-19-2020
12:00 PM
|
0
|
1
|
732
|
POST
|
Robert - So close, but I am still getting the same error: var editButton = new Button({ label: "Edit Schedule" }); editButton.on('click', lang.hitch(this, function () { editButton.setDisabled(true); //disable the edit button on first click WidgetManager.getInstance().triggerWidgetOpen("widgets/TaskManager/Widget_26") .then(lang.hitch(this, function (tmWidget) { //now you have a refernce to the Task Manager widget using tmWidget var })); })); editButton.startup(); >>>Uncaught TypeError: WidgetManager.getInstance().triggerWidgetOpen(...) is not a function. Could this be a scope error or am I using the wrong parameter here ("widgets/TaskManager/Widget_26")?
... View more
03-19-2020
11:44 AM
|
0
|
1
|
732
|
POST
|
Argghh! Getting the following error: Why would that be?!
... View more
03-19-2020
11:00 AM
|
0
|
1
|
732
|
POST
|
Yes, yes this is what I am looking for! 2 quick questions then: 1) Where does the `tmWidget` variable get defined? in the .then(tmWidget) part? Is this like an output variable? 2) My main config.json that defines widgets looks like this for Task Manager: { "uri": "widgets/TaskManager/Widget", "version": "1.2", "id": "widgets/TaskManager/Widget_26", "name": "TaskManager", "label": "Task Manager", "index": 11, "config": "configs/PEPCO/TaskManager/config_TaskManager_buzzardPoint.json", "position": { "width": 600 } }, Under "widgets", it is the 9th widget (index 8, assuming it starts with 0). How would I apply that to this: WidgetManager.getInstance().triggerWidgetOpen("the id of your widget in the apps main config.json") I would assume either WidgetManager.getInstance().triggerWidgetOpen("Widget_26"); or WidgetManager.getInstance().triggerWidgetOpen(( 'TaskManager')[8]); Am I on the right track there? -JB
... View more
03-19-2020
09:47 AM
|
0
|
1
|
732
|
POST
|
Yes, InfoTemplate is a custom widget that is essentially a popup that is launched when the user clicks a feature. I have added a button called "Edit Schedule" with an onClick event inside the InfoTemplate widget.js. That button (specifically the onClick event) is what I want to launch TaskManager (Task Manager can also be opened by simply clicking the TaskManager icon on the top navbar). So my workflow would be 1) User clicks on a feature and the InfoTemplate popup is opened. 2) At the bottom of the 'Detail' tab in InfoTemplate, the user will then click on the "Edit Schedule" to open the TaskManager widget. 3) The Task Manager widget opens. It doesn't matter if the both widgets remain open or not, as long as the TaskManager widget is open. 4) Final goal is to have the TaskManager widget also have the project and subproject populated based on the feature attribute called "Project Name" that appears in the form under the Detail tab in the InfoTemplate popup.
... View more
03-19-2020
08:25 AM
|
0
|
1
|
1858
|
POST
|
1. When the app starts up, it does not appear that the Task Manager widget is "opened." You only see the widget icon on the navbar and the use must click it before it triggers the "onOpen" function in TaskManager that opens it. 2. Not sure what you mean by "is InfoTemplate your reference above a widget." The InfoTemplate widget, unlike the popupMenu used in the Feature Action tutorial example, has it's own folder in the "widgets" directory. It also does not appear as opened when the app is first launched, none of the widgets are. The user must physically click on a layer to launch the InfoTemplate and open the contentPane. 3. Originally, yes, I simply wanted a button in the InfoTemplate that would do nothing more than open the TaskManager widget. However, if you look at the above picture of the InfoTemplate widget open, with the Edit Schedule button (this is the button I made to launch TaskManager), you will see that there is a form. This form is created from the attributes table of the feature being clicked. One of those attributes is "Project Name." Eventually what I want to do is not only open the TaskManager widget, but grab that project name and use it as a parameter to open the Task Manager and preselect a subproject using that "project" name. But for now, just getting the Task Manager to open no matter what feature is selected would be fine.
... View more
03-19-2020
07:34 AM
|
0
|
1
|
1858
|
POST
|
Robert, So using the feature action example, would I add the the showTaskManagerFeatureAction.js file under the widget>InfoTemplate folder (on the same level as widget.js) or under the TaskManager folder? And then add a function to launch TaskManager inside the TaskManager>widget.js file or the InfoTemplate>widget.js file? The example with showVertexCount uses popupMenu and it never explains what code to add to that (it's not a widget, just a part of the jimu or dijit library right?). It kinda confusing trying to apply that case to mine because I really don't want to do anything other than use a button to open the TaskManager widget (not dependent on any features).
... View more
03-18-2020
02:03 PM
|
0
|
1
|
1858
|
POST
|
Are you suggesting I use 'Create a feature action' in my custom `InfoTemplate` popup widget? Also, where do I find the widget id? Would it just be 'TaskManager'? Second question: From the feature action documentation it looks like I could use widget manager to get an instance and open the `TaskManager` widget: `WidgetManager.getInstance().triggerWidgetOpen(this.widgetId)` However, I am still confused about how to use the widgetId. Like this? `WidgetManager.getInstance().triggerWidgetOpen(this.TaskManager)`
... View more
03-17-2020
11:03 AM
|
0
|
1
|
1858
|
POST
|
Suppose I have created a button inside a custom InfoTemplate (aka 'popup') widget in my Web AppBuilder app: var editButton = new Button({
label: "Edit Schedule",
onClick: function () {
editButton.setDisabled(true); //disable the edit button on first click
} });
editButton.startup(); What I want is to launch another widget called 'TaskManager' when the onClick event is triggered. It seems like I need to use a library class called WidgetManager but I can find any practical example for my scenario. It seems like I need to use something like this: openWidget(widget) The openWidget method requires the Widget ID, which I am having trouble locating in my app (I know the name is TaskManager from the manifest.json file but can't find the id attribute). I've also seen example where a function is created, I assume inside the InfoTemplate widget, that will point to the TaskManager widget and can be called inside the click event: _openTaskManager: function () {
var taskManager, sbc;
var widgetCfg = this._getWidgetConfig('CustomInfoTemplate');
if (widgetCfg) {
sbc = WidgetManager.getInstance().getWidgetsByName('TaskManager')[0];
sbc._resizeToMax();
sbc.setOpenedIds([widgetCfg.id]);
}
}, then => _openTaskManager(); Am I on the right track? Is there an easy way to do this or am I way off? Any suggestions?
... View more
03-17-2020
10:35 AM
|
0
|
25
|
3517
|
POST
|
This looks like a viable solution except....my features literally have millions of rows. Using da.SearchCursor() to iterate through each row and write it to a file would probably take a huge amount of time.
... View more
11-05-2019
09:58 AM
|
1
|
0
|
10666
|
POST
|
Is there an arcpy method/mod that allows for the exporting of a feature class's attribute table to a csv file? I see arcpy.ConvertTableToCsvFile_roads, but that requires a special license. I am currently trying an `ogr2ogr` solution, but I am working within an ArcMap 10.5/Python 2.7 env and thought there would be something I could use.
... View more
11-05-2019
07:44 AM
|
1
|
9
|
11633
|
Title | Kudos | Posted |
---|---|---|
1 | 03-19-2021 01:41 PM | |
1 | 11-05-2019 09:58 AM | |
1 | 11-05-2019 07:44 AM | |
1 | 01-06-2021 05:41 AM | |
1 | 12-24-2020 06:48 AM |
Online Status |
Offline
|
Date Last Visited |
03-19-2022
10:13 PM
|