Closed jccartwright closed 2 years ago
I want to state this back a bit differently to confirm above with another explanation (using DataSourceFilterChangeMessage
as an example):
DataSourceFilterChangeMessage
contains the type
, widgetId
, and the dataSourceId
props.
If the DataSource
is a QueriableDataSource
, for instance, then an option could be to:
dataSourceId
returned from the message to select the appropriate DataSource
QueriableDataSource.getCurrentQueryParams()
like you are doing within your datasource-record-count
widget and is done in a few OOTB widgetsThe DataSource referenced by the dataSourceId in the message is a QueriableDataSource.
However, I'm not clear on how to construct a QueriableDataSource given that Id.
Ideally this could be done w/in the Action handler and then pass the queryParams as a string to trigger the widget's componentDidUpdate method
although I don't know if it's the best approach, I now have a working version. Using DataSourceManager to get the DataSource and ultimately the currentQueryParams and then passing that string which triggers the componentDidUpdate method.
Thanks @jccartwright. This implementation was added in this commit, yes?
https://github.com/jccartwright/exb-widgets/commit/41a2ad8b39d6ba5c59cb66d0650217b9b2c07c0c
Basically yes, although I significantly improved it in more recent commits in converting to functional component and using Redux hook.
If you’ve got some time tomorrow, I can walk you through what I now have on this and the client-side layer.
On Sep 6, 2022, at 9:28 AM, Shawn Goulet @.***> wrote:
Thanks @jccartwright https://github.com/jccartwright. This implementation was added in this commit, yes?
41a2ad8 https://github.com/jccartwright/exb-widgets/commit/41a2ad8b39d6ba5c59cb66d0650217b9b2c07c0c — Reply to this email directly, view it on GitHub https://github.com/jccartwright/exb-widgets/issues/5#issuecomment-1238309015, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHAEBVJLN3YHRY44ZNN3DLV45PJLANCNFSM577P55CA. You are receiving this because you were mentioned.
please review and comment on approach used in subscriber-demo
I think this approach, when not needing config options, is sound. I see the DataRecordsSelectionChange
coming through in the console and the way you set it up as a functional component makes sense to me.
Action handler, e.g. MessageHandlerAction is receiving framework message but lacks a good way to pass that on to the widget since the content of the message does not change with filter changes.
Can the datasource referenced in the message body be queried in the MessageHandlerAction to retrieve the queryParams and pass that as string?