selection event should send tableId
jadrake75 opened this issue · 2 comments
The selection event is only sending the { selected: [Array of Ids]} and it should also send the tableID in case there are multiple tables on a page.
Sending the table id for multiple tables means the controller needs to know the ID set on the table. This seems really awkward.
Actually this is to ensure the originator of the event is known. Lets say you have two tables managed by the same controller. JS is not strongly typed so you can't look at the data of the selected to drive the originator. It is good practice for events to always dispatch the data (or references) to what is changing (ie. the selected) and "where" it is selected from. It is up to the listener to decide if it cares to take some action from it. Since the selection event is not specific (could come from anywhere in the root scope hierarchy) the listener should know which source originated the event, so that it can decide whether to continue to take action on the items. Most UI frameworks (including JS do this with events. For example "target" or "source" of the UI Event object).