Select to view content in your preferred language

How to show attributes table in API4

5359
12
06-06-2018 02:31 AM
AhmadLibda
Occasional Contributor

4.x‌

js api 4.7

attribue table‌

How to show attributes table for a selected layer in API 4.7. I need anything similar to featuretable in API 3.

0 Kudos
12 Replies
AndyFairbairn
Regular Contributor

Thanks David - your example has made clear my simple mistake - I was missing the query part of the url. So in my example changing:

https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads/FeatureServer/0 

to

https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads/FeatureServer/0/query 

does the trick. 

Thanks again, 

Andy.

0 Kudos
DavidWilson3
Regular Contributor

No problem Andy, good luck with your project!

Cheers,

Dave

0 Kudos
DávidGregor
Emerging Contributor

Hello! I'm trying to make the table editable, but i cannot use somewhy ajax post request.

how do you send the edits to the server?

        table.MakeCellsEditable({
          onUpdate: applyEdits,
          inputCss: "my-input-class",
          columns: [34],
          confirmationButton: {
            confirmCss: "my-confirm-class",
            cancelCss: "my-cancel-class",
          },
          inputTypes: [
            {
              column: 3,
              type: "text",
              options: null,
            },
            {
              column: 4,
              type: "list",
              options: [
                { value: "1"display: "Progress },
                { value: "2"display: "Done" },
                { value: "3"display: "Error" },
              ],
            },
          ],
        });

        function applyEdits(updatedCellupdatedRow) {
          console.log("The new value for the cell is: " + updatedCell.data());
          console.log("The values for each cell in that row are: " + updatedRow.data());
          $.ajax({
            type: "POST",
            url: errorReportsUrl,
            data: updatedCell.data(),
            success: function(updatedCell){alert(updatedCell.data())},
            dataType: "application/json; charset=utf-8"
            });
        }
0 Kudos