I have multiple tabs that clients click through to make selections from list blocks (one click updates to SmartSuite data source). When they get to the proposal tab the top list block shows all of the items they selected on the previous tabs (conditionally filtered for the selections). This list block updates and displays correctly when they get to the proposals tab everything is appearing there as expected. The issue is I have a list block at the bottom of the proposals tab (below their selections) that is supposed to display the total $ of their selections. The data source is showing the correctly calculated total, but I cannot get the block to reflect the correct data, nor get it to reload and update. Until recently the custom code from @matthieu_chateau was working, but seems to no longer be.
Hi @Kristin,
I had the same problem reloading a chart block (Block 2) after a new record has been added in a list/table block (Block 1) above. I was trying to follow the documentation and it did not work. While debugging, I found that the events listed in the documentation are not triggered in Softr anymore. Strangely enough, the event that was triggered when add/update data was named “UPDATE_DATASOURCE” (without any mention of the Block 1 that triggers it). So I used the following to get this to work:
<script>
window.addEventListener("UPDATE_DATASOURCE", () => {
const invalidateChartCache = new CustomEvent(
"invalidate-chart-cache-chart1",
);
window.dispatchEvent(invalidateChartCache);
window.dispatchEvent(new CustomEvent("reload-block-chart1"));
});
</script>
Similarly. you can just listen to the event “UPDATE_DATASOURCE" to trigger the reload, I think.
1 Like
@rajesh Thank you for this.