<< Click to Display Table of Contents >>

new sg.controls.AttributeInspector(options)
Description
Create the AttributeInspector().
Position
AttributeInspector.js
Parameters
Parameter  | 
Type  | 
Description  | 
||||||||||||||||||||||||
options  | 
Object  | 
(optional) Control options set object 
  | 
Methods
Method  | 
Type  | 
Description  | 
destroy()  | 
none  | 
Remove Attributelnspector  | 
first()  | 
none  | 
Move to first selected feature  | 
hide()  | 
none  | 
Hide Attributelnspector  | 
last()  | 
none  | 
Move to last selected feature  | 
next()  | 
none  | 
Move to next selected feature  | 
previous()  | 
none  | 
Move to previous selected feature  | 
show()  | 
none  | 
Show AttributeInspector  | 
startup()  | 
none  | 
Initialize AttributeInspector  | 
Events
Event  | 
Description  | 
attribute-change  | 
Attribute changed  | 
delete  | 
Feature deleted  | 
next  | 
Change feature  | 
Example
 <script type="text/javascript" src="scripts/AttributeInspector.js"></script> 
 //Create AttributeInspector. var ai = new sg.controls.AttributeInspector({ layerInfos: { featureLayer: featureLayer, fieldInfos: [{ fieldName: "Id", editable : false }], editable : true } }); 
 //Set feature attribute. ai.on("attribute-change", function (e) { e.feature.attributes[e.fieldName] = e.fieldValue; }); 
 //Delete feature when delete button are clicked. ai.on("delete", function (e) { featureLayer.applyEdit(null, null, [e.feature]); }); 
 //Add save button on the AttributeInspector,before deleteButton. var saveBtn = document.createElement("button"); saveBtn.innerHTML = "Save"; ai.deleteButton.parentNode.insertBefore(saveBtn, ai.deleteButton); 
 //Edit feature attribute when save button clicked. AttachEvent(saveBtn, "click", function () { console.log("Save"); var features = featureLayer.getSelectedFeatures(); featureLayer.applyEdit(null, features, null); }); 
 //Append AttributeInspector to infowindow map.infoWindow.setContent(ai.node); map.infoWindow.resize(300, 240); 
 
 
 
 
 
 
  | 
|---|
©2015 Supergeo Technologies Inc.