Skip to content
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

Grid column auto-width doesn't work with async loaded data #215

Closed
sissbruecker opened this issue Jan 12, 2024 · 1 comment · Fixed by #223
Closed

Grid column auto-width doesn't work with async loaded data #215

sissbruecker opened this issue Jan 12, 2024 · 1 comment · Fixed by #223

Comments

@sissbruecker
Copy link
Contributor

sissbruecker commented Jan 12, 2024

When loading data asynchronously, autoWidth does not properly resize grid columns.

Reproduction:

function App() {
    const [items, setItems] = useState<number[] | undefined>();

    useEffect(() => {
       setTimeout(() => {
           const generatedItems = Array.from({length: 10}, (_, i) => i);
            setItems(generatedItems);
        }, 100);
    }, []);

    return (
        <div>
            <Grid items={items}>
                <GridColumn header="A" autoWidth flexGrow={0} renderer={model => `A long column text ${model.item}`}/>
                <GridColumn header="B" autoWidth flexGrow={0} renderer={model => `B ${model.item}`}/>
                <GridColumn header="C" autoWidth flexGrow={0} renderer={model => `C ${model.item}`}/>
            </Grid>
        </div>
    )
}

Outcome:
Bildschirmfoto 2024-01-12 um 11 22 39

Version: 2.4.0-alpha2

Related:

@sissbruecker
Copy link
Contributor Author

Was also reproducable in the docs grid-content.tsx example using the same alpha version, when removing the workaround for resizing workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant