Starting at version 2.2, you can customize the fields in the attribute inspector by specifying field information as part of the layer infos object.
dijit.byId("dijit_form_Button_0").set("label", "Dismiss");
dijit.registry.byId("esri_dijit_AttributeInspector_0").destroy(); dijit.registry.remove("esri_dijit_AttributeInspector_0");
var layerInfos = [{ 'featureLayer': featLayer, 'isEditable': true, 'showAttachments':false, 'showDeleteButton':false, 'disableAttributeUpdate':false, 'disableGeometryUpdate': true }]; attInspector = new esri.dijit.AttributeInspector({ layerInfos: layerInfos }, dojo.create("div")); //selectedTemplate is the selected template picked by the user selectedTemplate.featureLayer.applyEdits([newGraphic], null, null, function() { var screenPoint = map.toScreen(getInfoWindowPositionPoint(newGraphic)); map.infoWindow.setTitle("Incident about " + featLayer.name); map.infoWindow.setContent(attInspector.domNode); map.infoWindow.resize(260, 265); map.infoWindow.show(screenPoint, map.getInfoWindowAnchor(screenPoint)); templatePicker.clearSelection(); }); var DismissButton = new dijit.form.Button({ label: "Dismiss", "class": "deleteButton"}); var DoneButton = new dijit.form.Button({ label: "Done", "class": "closeButton"}); dojo.place(DismissButton.domNode,attInspector.deleteBtn.domNode, "before") dojo.place(DoneButton.domNode, DismissButton.domNode, "after"); dojo.connect(attInspector, "onAttributeChange", function(feature, fieldName, newFieldValue) { feature.attributes[fieldName] = newFieldValue; feature.getLayer().applyEdits(null, [feature], null); }); DoneButton.on("click", function(){ map.infoWindow.hide(); }); DismissButton.on("click", function(){ featLayer.applyEdits(null, null, [newGraphic]); map.infoWindow.hide(); });
Hi, did either of you find solutions to your problems? I am embarking down a similar path, modifying the attribute inspector, and creating and modifying buttons, curious if either of you have any tips for dealing with the attribute inspector and it's buttons? Thanks!
Also, I did try the sample posted above, and can't seem to place the save button correctly, it overlaps the delete button.
var saveButton = new Button({ label: "Save", "class": "saveButton"},domConstruct.create("div")); domConstruct.place(saveButton.domNode, attInspector.deleteBtn.domNode, "after");
How do you set the ID of the delete button in the attribute inspector? Thanks!
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.