function showResults(selectedFeatures) { var results = selectedFeatures.features; if (results.length != 0) { //create array of attributes var items = dojo.map(results, function (result) { return result.attributes; }); //Create data object to be used in store var data = { identifier: "GenSurvID", //This field needs to have unique values items: items }; //Create data store and bind to grid. store = new dojo.data.ItemFileWriteStore({ data: data }); var grid = dijit.byId('grid'); grid.setStore(store); grid.editable = true; } else { divNoRecords.style.display = 'block'; } if (divToggleDetail.className == 'divToggleDetailExpand') { AnimateDetailsView() } HideLoadingMessage2(); }
Solved! Go to Solution.
... What event should I use to tell pass the edits from the datagrid to the function where I call applyEdits? The dojo datagrid has an event "onApplyEdit", which is suppose to fire when an edit is aplied to the datagrid but I have not been able to get that to work.
var myGrid = dijit.byId("grid"); dojo.connect(myGrid, "onApplyCellEdit", gridCellEditHanler); function gridCellEditHanler(inValue, inRowIndex, inFieldIndex) { //call code here to handle cell edits alert("cell value change"); }
... What event should I use to tell pass the edits from the datagrid to the function where I call applyEdits? The dojo datagrid has an event "onApplyEdit", which is suppose to fire when an edit is aplied to the datagrid but I have not been able to get that to work.
var myGrid = dijit.byId("grid"); dojo.connect(myGrid, "onApplyCellEdit", gridCellEditHanler); function gridCellEditHanler(inValue, inRowIndex, inFieldIndex) { //call code here to handle cell edits alert("cell value change"); }
Hello Mark,
Did you ever get this to work in that datagrid? I'm looking at something similar right now.
function adminDoCellEdit(value, iRowIndex, iStoreIndex) { var grid = dijit.byId('grid'); var selectedItem = grid.getItem(iRowIndex); var objectID = grid.store.getValue(selectedItem, 'OBJECTID'); var pTask = 'surveyRecQueryTask'; surveyRecQueryTask = new esri.tasks.QueryTask("http://servername:6080/arcgis/rest/services/Internal_Secured/SurveyRecords2/MapServer/6"); var query = new esri.tasks.Query(); query.where = "OBJECTID = " + objectID; query.outFields = ["*"]; query.outSpatialReference = map.spatialReference; query.returnGeometry = true; surveyRecQueryTask.execute(query, function (featureList) { var feature = featureList.features[0]; if (feature.attributes[iStoreIndex] != value) { feature.attributes[iStoreIndex] = value; map.getLayer(surveyRecordsLayerID).applyEdits(null, [feature], null, callback, err2back); } else { // alert("You did not make any changes"); } }); }