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:
Kiran Ashok 2022-12-05 16:49:47 +05:30 committed by GitHub
parent c7251dcd01
commit a520cb30a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 1 deletions

View file

@ -455,6 +455,21 @@ export function Table({
},
[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(() => {
const selectedRowsOriginalData = selectedFlatRows.map((row) => row.original);

View file

@ -601,7 +601,7 @@ export const EventManager = ({
const newParam = { ...param, value: value };
const params = event?.componentSpecificActionParams ?? [];
const newParams = params.map((paramOfParamList) =>
paramOfParamList.handle === param.handle ? newParam : param
paramOfParamList.handle === param.handle ? newParam : paramOfParamList
);
handlerChanged(index, 'componentSpecificActionParams', newParams);
}}

View file

@ -363,6 +363,14 @@ export const widgets = [
},
],
},
{
handle: 'selectRow',
displayName: 'Select row',
params: [
{ handle: 'key', displayName: 'Key' },
{ handle: 'value', displayName: 'Value' },
],
},
],
definition: {
others: {