komarovalexander / ka-table

Lightweight MIT React Table component with Sorting, Filtering, Grouping, Virtualization, Editing and many more
http://ka-table.com
MIT License
787 stars 58 forks source link

Data not showing while using useEffect with state #429

Closed udayan-santu closed 4 months ago

udayan-santu commented 4 months ago

useEffect(() => { if(dataColumn !== null) { return table.changeProps({columns: dataColumn.map((column) => { if(column.type === 'text') { return { key: column.id, title: column.name, dataType: DataType.String, visible: column.visibility, sticky: column.sticky } } else if(column.type === 'image') { return { key: column.id, title: column.name, dataType: DataType.String, visible: column.visibility, sticky: column.sticky } } else { return { key: column.id, title: column.name, dataType: DataType.String, visible: column.visibility, sticky: column.sticky } } }) }); } }, [dataColumn]);

When I am using useEffect with [], the data are showing. but with a state -> dataColumn it going invisible data. Even noData props also not working.

komarovalexander commented 4 months ago

Hi @udayan-santu please provide stackblitz example https://stackblitz.com/edit/table-overview-ts?file=Demo.tsx

udayan-santu commented 4 months ago

Hi @udayan-santu please provide stackblitz example https://stackblitz.com/edit/table-overview-ts?file=Demo.tsx

Hi.. Thanks for your reply. Please check Stackblitz here

udayan-santu commented 4 months ago

I solved the problem, using, 2 more props, rowKeyField and data. Thank you