<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Multiple Feature Tables for each Feature Layer in Map (JS 4.24) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-feature-tables-for-each-feature-layer-in/m-p/1235589#M79463</link>
    <description>&lt;P&gt;I am trying to add in multiple feature tables into my web application. I have seen the post below, but they were using JS 3.x and I am using 4.x.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-javascript-questions/display-several-feature-tables/td-p/351361" target="_blank"&gt;https://community.esri.com/t5/arcgis-api-for-javascript-questions/display-several-feature-tables/td-p/351361&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Basically, I am hoping that I can add a tab that allows users to select which feature table they want to view. Here is the code I have so far that works, but it only displays one table...&lt;/P&gt;&lt;P&gt;JS&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;      // Create the feature table
      const featureTable = new FeatureTable({
        view: view, // Required for feature highlight to work
        layer: featureLayer,
        multiSortEnabled: true,
        visibleElements: {
          // Autocast to VisibleElements
          menuItems: {
            clearSelection: true,
            refreshData: true,
            toggleColumns: true,
            selectedRecordsShowAllToggle: true,
            selectedRecordsShowSelectedToggle: true,
            zoomToSelection: true
          }
        },
        container: document.getElementById("tableDiv")
      });

      // Listen for the view's click event and access the associated graphic.
      view.on("immediate-click", (event) =&amp;gt; {
        view.hitTest(event).then((response) =&amp;gt; {
          tableCandidate = response.results.find((result) =&amp;gt; {
            return (
              result.graphic &amp;amp;&amp;amp;
              result.graphic.layer &amp;amp;&amp;amp;
              result.graphic.layer === featureLayer
            );
          });

          // Add the graphic's ObjectId into the collection of highlightIds.
          // Check that the featureTable.highlightIds collection
          // does not include an already highlighted feature.
          if (tableCandidate) {
            const objectId = tableCandidate.graphic.getObjectId();

            if (featureTable.highlightIds.includes(objectId)) {
              // Remove feature from current selection if feature
              // is already added to highlightIds collection
              featureTable.highlightIds.remove(objectId);
            } else {
              // Add this feature to the featureTable highlightIds collection
              featureTable.highlightIds.add(objectId);
            }
          }
        });
      });

      // Watch the featureTable's highlightIds.length property,
      // and get the count of highlighted features within
      // the table.

      featureTable.watch("highlightIds.length", (ids) =&amp;gt; {
        highlightIdsCount = ids;

        // Iterate through the filters within the table.
        // If the active filter is "Show selection",
        // changes made to highlightIds (adding/removing)
        // are reflected.

        featureTable.viewModel.activeFilters.forEach((filter) =&amp;gt; {
          if (filter.type === "selection") {
            selectionIdCount = filter.objectIds.length; // the filtered selection's id count
            // Check that the filter selection count is equal to the
            // highlightIds collection count. If not, update filter selection.
            if (selectionIdCount !== highlightIdsCount) {
              featureTable.filterBySelection();
            }
          }
        });
      });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTML&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    &amp;lt;div id="mainWindow"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
            &amp;lt;div id="tableDiv"&amp;gt;&amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 28 Nov 2022 20:19:16 GMT</pubDate>
    <dc:creator>moremeowbell</dc:creator>
    <dc:date>2022-11-28T20:19:16Z</dc:date>
    <item>
      <title>Multiple Feature Tables for each Feature Layer in Map (JS 4.24)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-feature-tables-for-each-feature-layer-in/m-p/1235589#M79463</link>
      <description>&lt;P&gt;I am trying to add in multiple feature tables into my web application. I have seen the post below, but they were using JS 3.x and I am using 4.x.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-javascript-questions/display-several-feature-tables/td-p/351361" target="_blank"&gt;https://community.esri.com/t5/arcgis-api-for-javascript-questions/display-several-feature-tables/td-p/351361&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Basically, I am hoping that I can add a tab that allows users to select which feature table they want to view. Here is the code I have so far that works, but it only displays one table...&lt;/P&gt;&lt;P&gt;JS&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;      // Create the feature table
      const featureTable = new FeatureTable({
        view: view, // Required for feature highlight to work
        layer: featureLayer,
        multiSortEnabled: true,
        visibleElements: {
          // Autocast to VisibleElements
          menuItems: {
            clearSelection: true,
            refreshData: true,
            toggleColumns: true,
            selectedRecordsShowAllToggle: true,
            selectedRecordsShowSelectedToggle: true,
            zoomToSelection: true
          }
        },
        container: document.getElementById("tableDiv")
      });

      // Listen for the view's click event and access the associated graphic.
      view.on("immediate-click", (event) =&amp;gt; {
        view.hitTest(event).then((response) =&amp;gt; {
          tableCandidate = response.results.find((result) =&amp;gt; {
            return (
              result.graphic &amp;amp;&amp;amp;
              result.graphic.layer &amp;amp;&amp;amp;
              result.graphic.layer === featureLayer
            );
          });

          // Add the graphic's ObjectId into the collection of highlightIds.
          // Check that the featureTable.highlightIds collection
          // does not include an already highlighted feature.
          if (tableCandidate) {
            const objectId = tableCandidate.graphic.getObjectId();

            if (featureTable.highlightIds.includes(objectId)) {
              // Remove feature from current selection if feature
              // is already added to highlightIds collection
              featureTable.highlightIds.remove(objectId);
            } else {
              // Add this feature to the featureTable highlightIds collection
              featureTable.highlightIds.add(objectId);
            }
          }
        });
      });

      // Watch the featureTable's highlightIds.length property,
      // and get the count of highlighted features within
      // the table.

      featureTable.watch("highlightIds.length", (ids) =&amp;gt; {
        highlightIdsCount = ids;

        // Iterate through the filters within the table.
        // If the active filter is "Show selection",
        // changes made to highlightIds (adding/removing)
        // are reflected.

        featureTable.viewModel.activeFilters.forEach((filter) =&amp;gt; {
          if (filter.type === "selection") {
            selectionIdCount = filter.objectIds.length; // the filtered selection's id count
            // Check that the filter selection count is equal to the
            // highlightIds collection count. If not, update filter selection.
            if (selectionIdCount !== highlightIdsCount) {
              featureTable.filterBySelection();
            }
          }
        });
      });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTML&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    &amp;lt;div id="mainWindow"&amp;gt;
        &amp;lt;div class="container"&amp;gt;
            &amp;lt;div id="tableDiv"&amp;gt;&amp;lt;/div&amp;gt;
          &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Nov 2022 20:19:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-feature-tables-for-each-feature-layer-in/m-p/1235589#M79463</guid>
      <dc:creator>moremeowbell</dc:creator>
      <dc:date>2022-11-28T20:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Feature Tables for each Feature Layer in Map (JS 4.24)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-feature-tables-for-each-feature-layer-in/m-p/1235610#M79464</link>
      <description>&lt;P&gt;Here is an example of using multiple FeatureTables for multiple layers.&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/YzaLVgJ?editors=0010" target="_blank"&gt;https://codepen.io/odoe/pen/YzaLVgJ?editors=0010&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;view.when(() =&amp;gt; {
	const layers = map.layers
		.filter((layer) =&amp;gt; {
			return layer.type === "feature";
		})
		.toArray();
	let count = 0;
	for (const layer of layers) {
		// nav
		const title = document.createElement("calcite-tab-title");
		title.innerText = layer.title;
		if (count === 0) {
			title.active = true;
			count++;
		}
		tableNav.appendChild(title);
		// content
		const container = document.createElement("div");
		container.classList.add("table");
		const table = new FeatureTable({
			view,
			layer,
			container
		});
		const tab = document.createElement("calcite-tab");
		tab.appendChild(container);
		tabDiv.appendChild(tab);
	}
});&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Nov 2022 21:04:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-feature-tables-for-each-feature-layer-in/m-p/1235610#M79464</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-11-28T21:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Feature Tables for each Feature Layer in Map (JS 4.24)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-feature-tables-for-each-feature-layer-in/m-p/1238230#M79574</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7384"&gt;@ReneRubalcava&lt;/a&gt;&amp;nbsp;how to make that tab “closable”?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 14:19:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-feature-tables-for-each-feature-layer-in/m-p/1238230#M79574</guid>
      <dc:creator>Ranga_Tolapi</dc:creator>
      <dc:date>2022-12-06T14:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Feature Tables for each Feature Layer in Map (JS 4.24)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-feature-tables-for-each-feature-layer-in/m-p/1238369#M79578</link>
      <description>&lt;P&gt;You would need some logic using use DOMElement remove&lt;/P&gt;&lt;P&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/API/Element/remove" target="_blank"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Element/remove&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 17:00:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-feature-tables-for-each-feature-layer-in/m-p/1238369#M79578</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-12-06T17:00:15Z</dc:date>
    </item>
  </channel>
</rss>

