|
POST
|
Alejandro, This my complete code. _worksAfterCreate: function () {
//debugger;
this.editor.templatePicker.on("selection-change", lang.hitch(this, function() {
var selected = this.editor.templatePicker.getSelected();
if (selected) {
var featureLayer = selected.featureLayer;
on.once(featureLayer, "before-apply-edits", lang.hitch(this, function(evt){
if(evt.adds && evt.adds.length > 0){
if(evt.adds[0].attributes.hasOwnProperty('sfd_status')){
evt.adds[0].attributes.sfd_status = "NOT FLUSHED";
}
if (evt.adds[0].attributes.hasOwnProperty('sfd_edit_by')){
evt.adds[0].attributes.sfd_edit_by = StationShift;
}
if (evt.adds[0].attributes.hasOwnProperty('sfd_edit_date')){
evt.adds[0].attributes.sfd_edit_date = convertUTCDateToLocalDate(new Date(Date.now()));
}
refreshLayers(this.map, this.map.graphicsLayerIds);
this.editor.attributeInspector.refresh();
}
}));
}
}));
}, The section that may be most applicable to your situation is where I have a field called 'sfd_edit_by' that I am populating with my 'StationShift' variable defined elsewhere. if (evt.adds[0].attributes.hasOwnProperty('sfd_edit_by')){
evt.adds[0].attributes.sfd_edit_by = StationShift;
}
... View more
01-27-2016
09:14 AM
|
2
|
2
|
3653
|
|
POST
|
Alejandro, I did solve this issue using the code that Liz provided which Robert had suggested. Let me know if you have any questions on how I implemented this. Mele
... View more
01-27-2016
08:00 AM
|
3
|
4
|
3653
|
|
POST
|
If I look at the constructor details for the FeatureLayer, it shows mode as a parameter of type <number> with the following query modes liseted: FeatureLayer.MODE_SNAPSHOT: FeatureLayer.MODE_ONDEMAND: FeatureLayer.MODE_SELECTION: FeatureLayer.MODE_AUTO: What are the numbers that correspond to the above modes? I can see a number of 1 for my featureLayer but don't know what that corresponds to. Thanks, Mele
... View more
01-05-2016
02:44 PM
|
0
|
1
|
3132
|
|
POST
|
Changed my code slightly as shown below: //added to convert UTC to local Time function convertUTCDateToLocalDate(date) { date = new Date(date); var localOffset = date.getTimezoneOffset() * 60000; var localTime = date.getTime(); date = localTime - localOffset; //date = new Date(date); return date; };
... View more
01-05-2016
11:20 AM
|
0
|
0
|
27880
|
|
POST
|
I am using the Editor Widget in WAB to add a feature. I am then using the Batch Attribute Editor Widget to update the feature added by the editor widget. In my map service, I have set up a definition to query out the new feature and 'send' it to the layer used by the batch editor widget. In my map service I have two layers" Hydrant Review Missing Hydrant If I look in the map service the new feature shows up in the Hydrant Review Layer as expected, and not in the missing hydrant layer. However, when I look at the map in my application, the feature shows up in both layers until I close out the browser. When I close and re-open the browser, the feature appears correctly. There is only one feature in the Hydrant Review layer. Is there something being cached by the editor widget? I did do a refresh in my code on both layers, but this did not help. How can I get the map to show the newly added feature correctly? Thanks, Mele
... View more
01-04-2016
03:58 PM
|
0
|
1
|
3665
|
|
POST
|
Yes, Robert, that is what I was looking to do. Add some text dynamically to the Header Controller Widget below. I would like to add something at the end of 'Hydrant Maintenance Program'. It looks like this is the Title which is set in the config.json file.
... View more
12-24-2015
08:11 AM
|
0
|
5
|
2528
|
|
POST
|
Junshan Liu, setting the timeout worked to get the panel to open. It was an onscreen widget so that helped a lot! Thanks. Robert Scheitlin, GISP, I may end up using your solution as well, but for now it is working. You are both correct so I appreciate your help in solving my problem! Can I mark both of your answers as correct?
... View more
12-24-2015
08:00 AM
|
0
|
1
|
2892
|
|
POST
|
The error that I get is fail to close widget SFDShiftPickList. TypeError: Object doesn't support property or method 'setState' Thanks for any assistance.
... View more
12-23-2015
07:51 PM
|
0
|
1
|
2892
|
|
POST
|
I have a custom widget that requires user input I would like to ensure that the user has input data before they close the panel. I have some code that alerts the user if the data has not been input, but I would like the panel to re-open 'forcing' the user to set a value before proceeding. I was using the onClose function to check for the value and then re-open the panel, onClose: function(){ console.log('onClose'); if (!editor) { alert('Must set station/shift'); var pm = PanelManager.getInstance(); pm.openPanel(_34_panel); } } I got an error in console that lead me to believe that the widget had been destroyed by the time it got to my code. Has anyone done something like this? Thanks for any code samples. Mele
... View more
12-23-2015
02:54 PM
|
0
|
9
|
5604
|
|
POST
|
I may not be using the correct term but what I would like to do is to add some text to the title bar or header are in WAB application based on the selection made in another widget. How can I add some text dynamically to the title bar?
... View more
12-19-2015
04:32 PM
|
1
|
7
|
5335
|
|
POST
|
Thanks to Robert and Jian for your assistance. I was able to get this working as I wanted.
... View more
12-14-2015
02:00 PM
|
0
|
0
|
2700
|
|
POST
|
Robert, This is perfect! Thanks for the code. I've been experimenting with it and it is very easy once you gave me your sample.
... View more
12-13-2015
07:28 AM
|
0
|
0
|
2700
|
|
POST
|
This is very useful. Thanks for the help! I was able to create a widget with a combo box in it and then publish the data. This looks to be the path I needed. Right now, I am hung up on how to retrieve the data from my custom widget's data store. I did not understand the arguments for the onReceiveData method so I tried fetchDataByName on the widget I was using to call the data from and was able to 'see' my data as I stepped through the code, but was not able to 'get' the data. Is there a good example for the onReceiveData or even the fetchDataByName methods? I saw the widget example for the communication between widgets, but was not following it.
... View more
12-11-2015
05:58 PM
|
0
|
2
|
2700
|
|
POST
|
Thanks for the reply. It sounds like I can do what I am looking to do. Can you provide some details on how to open a widget at start? I did take a look at the sample widgets and the life cycle events, but I am not yet clear where to put a combo box within a custom widget. Also, I don't know how to save the selection from the Combo Box to a variable which I can use in other widgets. If you can provide some more details, I would appreciate it. The documentation on custom widgets is very brief. Is there something better out there to show me how to accomplish building a custom widget?
... View more
12-09-2015
04:58 PM
|
0
|
4
|
2700
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-27-2026 09:23 AM | |
| 1 | 02-26-2026 06:47 AM | |
| 3 | 10-20-2025 05:21 AM | |
| 1 | 03-13-2015 04:39 PM | |
| 1 | 09-18-2025 08:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|