The goal is to add a spreadsheet view to a GeoJSON Layer to comfty edit the properties directly in the spreadsheet and the location (lat/long) within the map by dragging the marker with leaflet.draw.
For the speadsheet functionality i found a nice lib called Handsontable: https://github.com/handsontable/handsontable
Handsontable works with array so I push the properties data with onEachFeature
in the array tableEditArray
and in the Leaflet Layer called drawnItems
and bind a mouseover
event on the marker to view the data:
onEachFeature: function(feature, layer) {
tableEditArray.push(feature.properties);
drawnItems.addLayer(layer);
layer.on('mouseover', function_to_view_properties);
}
Then I add drawnItems
to the map and initialise a Handsontable with the data from the array tableEditArray.
So far, so good, the map is drawn and the spreadsheet is editable:
If the user edits a cell in the sheet, how can I update the drawnItems
Layer and rerender the map?