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

Support variable heights per item #5

Open
maps82 opened this issue Apr 12, 2023 · 1 comment
Open

Support variable heights per item #5

maps82 opened this issue Apr 12, 2023 · 1 comment

Comments

@maps82
Copy link

maps82 commented Apr 12, 2023

For the lib to behave correctly it is necessary to specify an itemSize in pixels. It would be awesome if it would work with dynamic sizes per item. Is this planned or even possible in the current implementation?

@maps82 maps82 changed the title Support variable heights per element Support variable heights per item Apr 12, 2023
@anurag-dhamala
Copy link

Looks like I have found a workaround to adjust items of different sizes.

Give itemSize to around 200-300 (play around with it; dragging the items around), and give itemClass. (Say, the itemClass is "single-item"). Then, give the css to it in your global css file as below:

.single-item { 
   height: fit-content !important;
}

The DragDropList component should look something similar to this:

<DragDropList
                    id="verticalY"
                    type={VerticalDropZone}
                    itemSize={300}
                    itemClass="single-item"
                    itemCount={items.length}
                    on:drop={onDrop}
                    let:index
                    keyFn={(index)=> {
                        return items[index].id
                    }}
>

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

No branches or pull requests

2 participants