I've created a relatively complex dashboard that represents data across all the states. All my widgets are in-sync and properly update when the user changes selections, etc. I had a request to provide this dashboard, but at the state level only. Since I already have a state list widget setup, I was hoping to use everything that is currently working and simply set the selected state in the list widget. I have the code to determine the state the user is from, but I cannot find a good function to set the default value.
I was trying to over-ride the following function, but I'm not sure the right place to call it from during the loading process. Everything I've tried, ends up in an endless loop that throws and error.
private readonly selectRecords = (records: DataRecord[]) => {
const { datasource } = this.state
if (datasource) {
MessageManager.getInstance().publishMessage(
new DataRecordsSelectionChangeMessage(this.props.id, records)
)
if (records) {
this.isMySelected = true
this.isHasPublishMessageAction = true
datasource.selectRecordsByIds(records.map(record => record.getId()))
const outputDs = this.getOutputDs()
outputDs &&
outputDs.selectRecordsByIds(records.map(record => record.getId()))
} else {
this.isHasPublishMessageAction = false
}
}
}
I can easily determine the RecordID to set, but I need to figure out where to call this from during the initial load. On a related note, any ideas how to disable the widget programmatically, so the user can switch to see other data?