Handle selection of multiple rows in multiple QDataTables inside for loop
I have a list of collapsible’s in a v-for, and a QDataTable component inside with multiple selection as below.
<q-collapsible :label="req.label" v-for="(req, index) in requisitions" :key="index" class="collapsible-no-padding requisitionContainer" @open="openRequisition('Requisition' + req.reqId)" @close="closeRequisition('Requisition' + req.reqId)" :id='"Requisition" + req.reqId'> <q-list> <q-item link class='ordersContainer'> <q-item-main> <q-data-table :data="req.filteredOrdersList" :config="orderConfigs" :columns="orderColumns" @selection="selectOrders"> </q-data-table> </q-item-main> </q-item> </q-list> </q-collapsible>
It looks like this Image
However, since there are more than one table, if a selection is made on any of the tables, it does call the selection method with the selected item, but I have no way to tell which table is it a part of. This is a problem when a selection is removed, for which I need to distinguish between each tables selection event. Is there a way to do it?
I got the answer here.