Im trying to build a custom widget with the leaflet API.
I have a Snowflake DB with some data. I query that in a query called get_lic.
select distinct
l.callsign,
l.license_key,
l.licensee_name,
st_asgeojson(l.license_area) as geojson_column,
l.status
from license as l
join frequency_range f on l.license_key = f.license_key
where
f.start_frequency >= {{freqSlider.start}}
and f.end_frequency <= {{freqSlider.end}}
order by callsign
limit 800;
This query has the "Run query on page load" setting toggled to true.
The idea is that the page should load, this query should be run (based on the default values set for the freqSlider), the results returned should populate my table, and in turn, the Custom widget leaflet map should display the data as it is in my table.
The Default Model in my Custom Widget is set up to pass in the licenseTable.tableData.
But my problems I'm having so far are these:
- When the page loads, for some reason, the query does not run unless I turn on "Request confirmation before running query", in which case, the modal for that option pops up, and if I click yes, the query runs fine.
1.a. I think this may have something to do with the fact thatget_licdepends on the default values set in thefreqSlider, which themselves are retrieved dynamically using a different query that sets maximum and minimum default values (see attached image). If I hard code these values, the query runs fine, but I wish I could set max and min dynamically. - Even if the query does run, on page load or otherwise, the Leaflet app in the Custom Widget does not display the data. The only way I can get the Widget to display the data in my table is by clicking into the "Edit Source" on the Custom Widget, and re-running the JS from within.
Any help would be appreciated. If @patent jewel you have any advice, I would greatly appreciate it - your FTW video on leaflet has been tremendously helpful so far 🙂 Thanks!