Hi,
I'm looking for the best / easiest way to listen for record selection change.
I've got a widget that displays records, much the same as the built in List widget. I'm listening for an onclick event in the map to get selected records, and update my list with the clicked record. The problem, it seems that the onclick listens and responds before the framework has actually updated the datasource > selectedrecords. So the onclick triggers my code and grabs the previous selection.
I don't see a simple "watch > selection change" type event. (I'd happy to be wrong, should one exist).
Looking at the code for the actual List widget, it seems to handle this by:
- componentDidUpdate
- getSelectedRecords
- Compare selectedRecords to lastSelectedRecord
- If different, do something... and update lastSelectedRecord
This makes perfect sense, but the built in widget has to handle a lot of use cases and workflows as it's configurable for different scenarios. So, again, wondering if anyone has come across a simpler (yet, less robust) way of listening for the selected set change?