<?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 custom widget watching DataSource queryParams in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-watching-datasource-queryparams/m-p/1572642#M16767</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I'm trying to create a custom widget which watches the configured DataSource for changes to the layer definition query (i.e. monitors when an attribute filter has been applied/removed). I've tried something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// called once when DataSourceComponent loads
function onDataSourceCreated (ds: DataSource) {
  // uses a user-defined type guard using type predicate
  const featureLayerDataSource = isFeatureLayerDataSourceType(ds) ? ds : undefined
  const queryParams = featureLayerDataSource.getCurrentQueryParams()
  // TODO why does watch never see changes to where property?
  reactiveUtils.watch(
    () =&amp;gt; queryParams.where,
    str =&amp;gt; { setQueryParams(str) }
    )
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can make it work when using a DataSourceFilterChange action but can't understand why the same result cannot be obtained using the reactiveUtils and watching the DataSource directly&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;--john&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 04 Jan 2025 20:37:05 GMT</pubDate>
    <dc:creator>john_cartwright_noaa</dc:creator>
    <dc:date>2025-01-04T20:37:05Z</dc:date>
    <item>
      <title>custom widget watching DataSource queryParams</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-watching-datasource-queryparams/m-p/1572642#M16767</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I'm trying to create a custom widget which watches the configured DataSource for changes to the layer definition query (i.e. monitors when an attribute filter has been applied/removed). I've tried something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// called once when DataSourceComponent loads
function onDataSourceCreated (ds: DataSource) {
  // uses a user-defined type guard using type predicate
  const featureLayerDataSource = isFeatureLayerDataSourceType(ds) ? ds : undefined
  const queryParams = featureLayerDataSource.getCurrentQueryParams()
  // TODO why does watch never see changes to where property?
  reactiveUtils.watch(
    () =&amp;gt; queryParams.where,
    str =&amp;gt; { setQueryParams(str) }
    )
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can make it work when using a DataSourceFilterChange action but can't understand why the same result cannot be obtained using the reactiveUtils and watching the DataSource directly&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;--john&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jan 2025 20:37:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-watching-datasource-queryparams/m-p/1572642#M16767</guid>
      <dc:creator>john_cartwright_noaa</dc:creator>
      <dc:date>2025-01-04T20:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: custom widget watching DataSource queryParams</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-watching-datasource-queryparams/m-p/1572767#M16776</link>
      <description>&lt;P&gt;I think the fundamental problem here is that an Experience Builder datasource and a Javascript API FeatureLayer are not actually the same thing. If you get the FeatureLayer using API methods, reactiveUtils should work.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 13:38:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-watching-datasource-queryparams/m-p/1572767#M16776</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2025-01-06T13:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: custom widget watching DataSource queryParams</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-watching-datasource-queryparams/m-p/1576723#M16962</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/532492"&gt;@john_cartwright_noaa&lt;/a&gt;, the reactiveUtils is used to&amp;nbsp;&lt;SPAN&gt;observe changes to the state of the JSAPI's properties. The feature layer data source is not the same as the JSAPI feature layer. To watch the query params changes, I suggest to use the &lt;A href="https://developers.arcgis.com/experience-builder/api-reference/jimu-core/DataSourceComponentProps/#onQueryRequired" target="_self"&gt;onQueryRequired&lt;/A&gt; props of the DataSourceComponent.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 05:57:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/custom-widget-watching-datasource-queryparams/m-p/1576723#M16962</guid>
      <dc:creator>YueyangLi</dc:creator>
      <dc:date>2025-01-17T05:57:01Z</dc:date>
    </item>
  </channel>
</rss>

