<?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: ArcGIS API For Js 4.x Need event while save bookmarks in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1378542#M83577</link>
    <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/233731"&gt;@Justin_Greco&lt;/a&gt;&amp;nbsp;. I'm able to save the bookmarks and refresh the browser to see the bookmarks but one issue is that it's going to the extent which I was set in the bookmark only it's zoom to that location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached the code pen, in the sample i was set chicago as center of bookmark and refresh the app then it's going to scale of chicago but now it's showing Kansas as center.&lt;BR /&gt;&lt;A href="https://codepen.io/SaiAnand-Peketi/pen/OJqErda" target="_blank"&gt;https://codepen.io/SaiAnand-Peketi/pen/OJqErda&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Feb 2024 07:15:44 GMT</pubDate>
    <dc:creator>SaiPeketi</dc:creator>
    <dc:date>2024-02-06T07:15:44Z</dc:date>
    <item>
      <title>ArcGIS API For Js 4.x Need event while save bookmarks</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1377773#M83540</link>
      <description>&lt;P&gt;Hi, Could anyone please suggest me for the event to store the bookmarks in the session cookies. I'm able to see in 3.x&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/3/jssamples/exp_bookmarks_stored_client_side.html" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/3/jssamples/exp_bookmarks_stored_client_side.html&lt;/A&gt;. Is anyway to call a function that what it stored the bookmarks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sai&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2024 20:02:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1377773#M83540</guid>
      <dc:creator>SaiPeketi</dc:creator>
      <dc:date>2024-02-02T20:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API For Js 4.x Need event while save bookmarks</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1378155#M83553</link>
      <description>&lt;P&gt;There is bookmark-edit event for the Bookmarks widget, which is triggered when a bookmark is modified (name changed, extent changed), but there isn't an event for when a bookmark is added or removed.&amp;nbsp; You will need to use the after-changes event on the widgets bookmarks collection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const storeBookmarks = (bookmarks) =&amp;gt; {
  window.localStorage.setItem('bookmarks', JSON.stringify(bookmarks));
};
require(["esri/views/MapView", "esri/WebMap", "esri/widgets/Bookmarks"], (MapView, WebMap, Bookmarks) =&amp;gt; {
  const webmap = new WebMap({
    portalItem: {
      id: "70b726074af04a7e9839d8a07f64c039"
    }
  });

  const view = new MapView({
    map: webmap,
    container: "viewDiv"
  });

  const bookmarks = new Bookmarks({
    view: view,
    editingEnabled: true,
  });
  //load bookmarks from local storage
  if (window.localStorage.getItem('bookmarks')) {
    const bms = JSON.parse(window.localStorage.getItem('bookmarks'));
    bms?.forEach(bm =&amp;gt; bm.viewpoint.targetGeometry.type = 'extent');
    bookmarks.bookmarks = bms;
  }
  view.ui.add(bookmarks, 'top-right');
  //store bookmarks when added or removed or reordered
  bookmarks.bookmarks.on('after-changes', () =&amp;gt; storeBookmarks(bookmarks.bookmarks));
  //store boomarks when a bookmark is edited
  bookmarks.on('bookmark-edit', () =&amp;gt; storeBookmarks(bookmarks.bookmarks));
});   &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 12:56:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1378155#M83553</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2024-02-07T12:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API For Js 4.x Need event while save bookmarks</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1378542#M83577</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/233731"&gt;@Justin_Greco&lt;/a&gt;&amp;nbsp;. I'm able to save the bookmarks and refresh the browser to see the bookmarks but one issue is that it's going to the extent which I was set in the bookmark only it's zoom to that location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached the code pen, in the sample i was set chicago as center of bookmark and refresh the app then it's going to scale of chicago but now it's showing Kansas as center.&lt;BR /&gt;&lt;A href="https://codepen.io/SaiAnand-Peketi/pen/OJqErda" target="_blank"&gt;https://codepen.io/SaiAnand-Peketi/pen/OJqErda&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 07:15:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1378542#M83577</guid>
      <dc:creator>SaiPeketi</dc:creator>
      <dc:date>2024-02-06T07:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API For Js 4.x Need event while save bookmarks</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1379044#M83592</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/204563"&gt;@SaiPeketi&lt;/a&gt;&amp;nbsp;I updated the code above.&amp;nbsp; It was throwing an error that the geometry type wasn't being specified since its autocasting the targetGeometry of the viewpoint of the bookmarks.&amp;nbsp; When loading the bookmarks, I am just looping through the bookmarks and setting the targetGeometry type to extent.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  //load bookmarks from local storage
  if (window.localStorage.getItem('bookmarks')) {
    const bms = JSON.parse(window.localStorage.getItem('bookmarks'));
    bms?.forEach(bm =&amp;gt; bm.viewpoint.targetGeometry.type = 'extent');
    bookmarks.bookmarks = bms;
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 12:59:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1379044#M83592</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2024-02-07T12:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API For Js 4.x Need event while save bookmarks</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1379306#M83599</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/233731"&gt;@Justin_Greco&lt;/a&gt;. It's working fine now.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 19:14:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-for-js-4-x-need-event-while-save/m-p/1379306#M83599</guid>
      <dc:creator>SaiPeketi</dc:creator>
      <dc:date>2024-02-07T19:14:19Z</dc:date>
    </item>
  </channel>
</rss>

