Inserting / deleting records/rows from a non-spatial table

5521
12
Jump to solution
06-06-2016 09:38 AM
NaciDilekli
Occasional Contributor

Hello,

I was already able to edit existing records a non-spatial table in my SDE database using FeatureLayer and FeatureTable following this example (Using FeatureTable (no map) | ArcGIS API for JavaScript) and using the editable property. I would now like to be able to insert (clicking a button would add a blank record at the bottom) and delete selected records from this table. Is this possible? I thought about using applyEdits but I understand it will only accept graphics as parameters (FeatureLayer | API Reference | ArcGIS API for JavaScript)

Thanks!

0 Kudos
12 Replies
NaciDilekli
Occasional Contributor

This does display the table fine, but then the add / update / delete operations do not work. For add it gives "the add did not work", for update it gives "the update did not work" (the popups) and for delete it gives this error on the console:

init.js:113 TypeError: this._createStoreFromDataQuery is not a function(…) "TypeError: this._createStoreFromDataQuery is not a function

    at _refreshGrid (http://127.0.0.1:8020/extendFeatureTable/module/featureTableEditor.js:80:12)

    at http://127.0.0.1:8020/extendFeatureTable/module/featureTableEditor.js:285:19

    at a (https://js.arcgis.com/3.17/init.js:660:469)

    at c (https://js.arcgis.com/3.17/init.js:103:393)

    at d (https://js.arcgis.com/3.17/init.js:103:182)

    at resolve.callback (https://js.arcgis.com/3.17/init.js:105:10)

    at Object._resDfd (https://js.arcgis.com/3.17/init.js:661:122)

    at _resolve (https://js.arcgis.com/3.17/init.js:1937:79)

    at _editHandler (https://js.arcgis.com/3.17/init.js:1954:397)

    at Object.load (https://js.arcgis.com/3.17/init.js:1912:132)"

0 Kudos
BillDaigle
Occasional Contributor III

Looks like they changed some internal functions (anything function with an underscore should be referenced at your own risk) that I am referencing in the “_refreshGrid” function. Their version of the editor updates the grid, then applies the changes to the feature layer. My version edits the feature layer directly (using the attribute editor), then forces a refresh on the data. Based on the 3.17 documentation, it looks like they may have added a refresh function. You might try replacing this line:

this._createStoreFromDataQuery();

with:

this.refresh();

0 Kudos
NaciDilekli
Occasional Contributor

I tried the refresh() function before, and it never refreshed the data as I wanted it, and it doesn't work in this instance either. I think for now I will work with the 3.16 version, and try to understand your code to migrate it to 3.17 and/or 4.0 in the future. I still need to understand some of the fundamentals such as extending classes as you did. Are there any resources on extending the ESRI API that you are aware of?

0 Kudos