Minor fixes for table autogenerate column

This commit is contained in:
Shaurya Sharma 2024-11-06 16:20:00 +05:30
parent dd1620a3bd
commit 8515d226bc
2 changed files with 3 additions and 7 deletions

View file

@ -139,7 +139,6 @@ export const Table = React.memo(
const updatedDataReference = useRef([]);
const preSelectRow = useRef(false);
const initialPageCountRef = useRef(null);
const isInitialRender = useRef(true);
const allAppEvents = useEvents();
// const { events: allAppEvents } = useAppInfo();
const tableEvents = allAppEvents.filter((event) => event.target === 'component' && event.sourceId === id);
@ -578,10 +577,8 @@ export const Table = React.memo(
dynamicColumn,
setComponentProperty,
properties.autogenerateColumns ?? false,
id,
isInitialRender.current
id
);
isInitialRender.current = false;
if (useDynamicColumn) {
const dynamicColumnHasId = dynamicColumn && dynamicColumn.every((column) => 'id' in column);
if (!dynamicColumnHasId) {

View file

@ -9,8 +9,7 @@ export default function autogenerateColumns(
dynamicColumn = [],
setProperty,
generateNestedColumns,
id,
isInitialRender
id
) {
if (useDynamicColumn) {
if (dynamicColumn.length > 0 && dynamicColumn[0].name) {
@ -111,7 +110,7 @@ export default function autogenerateColumns(
setTimeout(
() =>
setProperty(id, 'columns', finalColumns, 'properties', undefined, undefined, undefined, {
skipUndoRedo: isInitialRender,
skipUndoRedo: true,
saveAfterAction: true,
}),
10