-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataTable: virtualScrollerOptions with scrollHeight="flex" causes the table to disappear #7579
Comments
I could be wrong but I am not sure virtualscroller can work with flex it needs a defined height to render. |
This comment was marked as off-topic.
This comment was marked as off-topic.
ok when you set it to flex it makes it However the parent container has NO height so you have to give the datatable a height as well. <DataTable value={cars} scrollable scrollHeight="flex"
virtualScrollerOptions={{ itemSize: 46 }}
tableStyle={{ minWidth: '50rem' }}
style={{ height: '400px' }}> So either way it looks like VirtualScroller needs a fixed height. |
as a note PrimeVue has the same issue and same conclusion I came to: primefaces/primevue#6870 |
@melloware i always uses flex for 100%. <DataTable
ref={tableRef}
virtualScrollerOptions={{ itemSize: 46, className: "flex flex-auto align-items-start" }}
dataKey="id"
value={myData}
className="flex-auto overflow-hidden" |
But he is using scrollheight and you are not? |
Update: <Splitter layout="vertical" className="flex flex-auto border-none overflow-hidden">
<SplitterPanel className="flex border-none overflow-hidden">
<DataTable
ref={tableRef}
virtualScrollerOptions={{ itemSize: 46, className: "flex flex-auto align-items-start" }}
dataKey="id"
value={myData}
className="flex-auto overflow-hidden"
header={renderHeader}
size="small"
selectionMode="multiple"
selection={mySelection}
onSelectionChange={handleSelectionChange}
stripedRows
resizableColumns
columnResizeMode="expand"
reorderableColumns
dragSelection
scrollable
scrollHeight="flex" // <<<< here it is!
sortMode="multiple"
multiSortMeta={multiSortMeta}
loading={loading}
tableStyle={{ tableLayout: 'fixed', flex: '1 1 auto' }}
> I guess it's working because we're using flex/grid everywhere so the whole DOM-Tree has all information required for flex to work as expected. There're several thing about flex that you should know - e.g. you need a height definition in any container that contains flex so in my case its on html/body manually set to 100%.
|
Awesome closing as workaround provided! |
Describe the bug
I copied the code from https://primereact.org/datatable/#virtualscroll and changed from scrollHeight="400px” to scrollHeight=“flex”. After this change, the table disappeared
Reproducer
https://stackblitz.com/edit/ynbybwop?file=src%2FApp.jsx
System Information
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: