mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Feature :: SelectRow CSA :: [ Table ] (#4591)
* feat :: prototyping selectrow csa * fix :: bug * removed :: logs * bugfix :: page does not contain whole data changed to rows * fix :: for table inside modal * fix:: csa not working for table inside modal * fix :: table csa in modal * fix :: multiple event params
This commit is contained in:
parent
c7251dcd01
commit
a520cb30a8
3 changed files with 24 additions and 1 deletions
|
|
@ -455,6 +455,21 @@ export function Table({
|
||||||
},
|
},
|
||||||
[serverSidePagination, clientSidePagination, setPaginationInternalPageIndex]
|
[serverSidePagination, clientSidePagination, setPaginationInternalPageIndex]
|
||||||
);
|
);
|
||||||
|
registerAction(
|
||||||
|
'selectRow',
|
||||||
|
async function (key, value) {
|
||||||
|
const item = tableData.filter((item) => item[key] == value);
|
||||||
|
const row = rows.find((item, index) => item.original[key] == value);
|
||||||
|
if (row != undefined) {
|
||||||
|
const selectedRowDetails = { selectedRow: item[0], selectedRowId: row.id };
|
||||||
|
mergeToTableDetails(selectedRowDetails);
|
||||||
|
setExposedVariables(selectedRowDetails).then(() => {
|
||||||
|
fireEvent('onRowClicked');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[JSON.stringify(tableData), JSON.stringify(tableDetails.selectedRow)]
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const selectedRowsOriginalData = selectedFlatRows.map((row) => row.original);
|
const selectedRowsOriginalData = selectedFlatRows.map((row) => row.original);
|
||||||
|
|
|
||||||
|
|
@ -601,7 +601,7 @@ export const EventManager = ({
|
||||||
const newParam = { ...param, value: value };
|
const newParam = { ...param, value: value };
|
||||||
const params = event?.componentSpecificActionParams ?? [];
|
const params = event?.componentSpecificActionParams ?? [];
|
||||||
const newParams = params.map((paramOfParamList) =>
|
const newParams = params.map((paramOfParamList) =>
|
||||||
paramOfParamList.handle === param.handle ? newParam : param
|
paramOfParamList.handle === param.handle ? newParam : paramOfParamList
|
||||||
);
|
);
|
||||||
handlerChanged(index, 'componentSpecificActionParams', newParams);
|
handlerChanged(index, 'componentSpecificActionParams', newParams);
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -363,6 +363,14 @@ export const widgets = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
handle: 'selectRow',
|
||||||
|
displayName: 'Select row',
|
||||||
|
params: [
|
||||||
|
{ handle: 'key', displayName: 'Key' },
|
||||||
|
{ handle: 'value', displayName: 'Value' },
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
definition: {
|
definition: {
|
||||||
others: {
|
others: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue