In that snippet Dataviews 'getSelectedItem()' returns undefined and also 'getSelectedId()' returns wrong id. It returns the ID from previously selected Item.
I don't think it supposed to be so.
onItemClick fires before the selection is applied to the clicked item, so it is the expected result. Please use onAfterSelect instead.
Also, you can check the order of all events and avoid common issues using the debug version of the library.
@Listopad , thanks thanks thanks.
It looks like you're new here. If you want to get involved, click one of these buttons!