<?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 Re: The map viewer is not initialized exception when opening attribute tables back to back in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365665#M10962</link>
    <description>&lt;P&gt;Hi Tony,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error message is a little misleading.&amp;nbsp; But essentially before you open a table pane you must have a mapView active.&amp;nbsp; &amp;nbsp;Unfortunately once a table pane has been opened it becomes the active view.&amp;nbsp; So the first table pane opens successfully, but then your mapView is no longer active which is why the second (and subsequent) attempts to open a table pane fail.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should be able to open multiple table panes by code similar to the following&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var mv = MapView.Active;
if (mv == null)
  return;

// get the active pane (the pane of the active mapView)
var pane = FrameworkApplication.Panes.ActivePane;  

foreach (var layer in attributeTableLayers)
{
  try
  {
    // open a table pane
    FrameworkApplication.Panes.OpenTablePane(layer, TableViewMode.eAllRecords);

    // reactivate the pane for the mapview
    pane.Activate();
  }
  catch (Exception ex)
  {   
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Narelle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jan 2024 05:00:22 GMT</pubDate>
    <dc:creator>NarelleChedzey</dc:creator>
    <dc:date>2024-01-03T05:00:22Z</dc:date>
    <item>
      <title>The map viewer is not initialized exception when opening attribute tables back to back</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365301#M10947</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a use case where I will have a list of layers for which I want to open the attribute table after those layers have already been added to the active map.&lt;/P&gt;&lt;P&gt;foreach (var layer in attributeTableLayers)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;FrameworkApplication.Panes.OpenTablePane(layer, TableViewMode.eAllRecords);&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The first layer's attribute table is opened but for the next, an exception is occurring&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;System.InvalidOperationException: 'The map viewer is not initialized.'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;What is the best way to open attribute tables for multiple layers back-to-back?&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp; &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 13:51:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365301#M10947</guid>
      <dc:creator>TonyO</dc:creator>
      <dc:date>2024-01-02T13:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: The map viewer is not initialized exception when opening attribute tables back to back</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365381#M10950</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would recommend start from checking is it possible to open table pane for the layer:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;foreach (var layer in attributeTableLayers)

{
     if(FrameworkApplication.Panes.CanOpenTablePane(layer))
         FrameworkApplication.Panes.OpenTablePane(layer, TableViewMode.eAllRecords);

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 15:17:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365381#M10950</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-01-02T15:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: The map viewer is not initialized exception when opening attribute tables back to back</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365478#M10954</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;I had already tried this but the exception is same&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 18:12:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365478#M10954</guid>
      <dc:creator>TonyO</dc:creator>
      <dc:date>2024-01-02T18:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: The map viewer is not initialized exception when opening attribute tables back to back</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365520#M10958</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You must be on the UI thread to call&amp;nbsp;OpenTablePane function.&amp;nbsp; Do not call it on MCT thread (in QueuedTask.Run).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 19:12:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365520#M10958</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-01-02T19:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: The map viewer is not initialized exception when opening attribute tables back to back</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365640#M10960</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp; I am on Ui thread and not calling in MCT. Thats the reason first table is opened in the list. The issue is coming when in loop second table is trying to be opened as I mentioned in my question&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 23:53:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365640#M10960</guid>
      <dc:creator>TonyO</dc:creator>
      <dc:date>2024-01-02T23:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: The map viewer is not initialized exception when opening attribute tables back to back</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365665#M10962</link>
      <description>&lt;P&gt;Hi Tony,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error message is a little misleading.&amp;nbsp; But essentially before you open a table pane you must have a mapView active.&amp;nbsp; &amp;nbsp;Unfortunately once a table pane has been opened it becomes the active view.&amp;nbsp; So the first table pane opens successfully, but then your mapView is no longer active which is why the second (and subsequent) attempts to open a table pane fail.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should be able to open multiple table panes by code similar to the following&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var mv = MapView.Active;
if (mv == null)
  return;

// get the active pane (the pane of the active mapView)
var pane = FrameworkApplication.Panes.ActivePane;  

foreach (var layer in attributeTableLayers)
{
  try
  {
    // open a table pane
    FrameworkApplication.Panes.OpenTablePane(layer, TableViewMode.eAllRecords);

    // reactivate the pane for the mapview
    pane.Activate();
  }
  catch (Exception ex)
  {   
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Narelle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 05:00:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/the-map-viewer-is-not-initialized-exception-when/m-p/1365665#M10962</guid>
      <dc:creator>NarelleChedzey</dc:creator>
      <dc:date>2024-01-03T05:00:22Z</dc:date>
    </item>
  </channel>
</rss>

