Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/client/src/mockResponses/WidgetConfigResponse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ const WidgetConfigResponse: WidgetConfigReducerState = {
TABLE_WIDGET: {
rows: 7 * GRID_DENSITY_MIGRATION_V1,
columns: 9 * GRID_DENSITY_MIGRATION_V1,
defaultSelectedRow: "0",
label: "Data",
widgetName: "Table",
searchKey: "",
Expand Down
19 changes: 19 additions & 0 deletions app/client/src/utils/WidgetPropsUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,11 @@ const transformDSL = (currentDSL: ContainerWidgetProps<WidgetProps>) => {

if (currentDSL.version === 31) {
currentDSL = migrateIsDisabledToButtonColumn(currentDSL);
currentDSL.version = 31;
}

if (currentDSL.version === 31) {
currentDSL = migrateTableDefaultSelectedRow(currentDSL);
currentDSL.version = LATEST_PAGE_VERSION;
}

Expand Down Expand Up @@ -851,6 +856,20 @@ const addIsDisabledToButtonColumn = (
return currentDSL;
};

export const migrateTableDefaultSelectedRow = (
currentDSL: ContainerWidgetProps<WidgetProps>,
) => {
if (currentDSL.type === WidgetTypes.TABLE_WIDGET) {
if (!currentDSL.defaultSelectedRow) currentDSL.defaultSelectedRow = "0";
}
if (currentDSL.children && currentDSL.children.length) {
currentDSL.children = currentDSL.children.map((child) =>
migrateTableDefaultSelectedRow(child),
);
}
return currentDSL;
};

const migrateIsDisabledToButtonColumn = (
currentDSL: ContainerWidgetProps<WidgetProps>,
) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface TableWidgetProps extends WidgetProps, WithMeta, TableStyles {
label: string;
searchText: string;
defaultSearchText: string;
defaultSelectedRow?: number | number[];
defaultSelectedRow?: number | number[] | string;
tableData: Array<Record<string, unknown>>;
onPageChange?: string;
pageSize: number;
Expand Down