TableList component

This sample demonstrates how to add a table list and view a table's data in the feature table component.

In this example, two FeatureLayer tables are displayed in the table list. One table is saved within a WebMap, while the other is added programmatically in the app by calling the Layer.fromPortalItem method and passing in the itemId of the associated hosted table. Selecting one of the tables in the table list will display the table's data in the feature table component.

In order for the component to recognize if a table is valid, the feature layer's isTable property must return true.

When a table is loaded dynamically, it must first be loaded and then added to the map's tables collection.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
        // A function to add a table to the map and feature table
        // from a portal item id
        async function addTable(id) {
          const table = await Layer.fromPortalItem({
            portalItem: new PortalItem({
              id
            })
          });
          // Wait for the table to load
          await table.load();

          // If the table is a table,
          // set the title and add it to the map and feature table
          if (table.isTable) {
            table.title = "Table from portal item";
            arcgisMap.addTable(table);
            arcgisFeatureTable.layer = table;
          }
        }

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.