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

bug: the gap not work #90

Open
liuJchun opened this issue Mar 29, 2023 · 13 comments
Open

bug: the gap not work #90

liuJchun opened this issue Mar 29, 2023 · 13 comments
Labels
question Further information is requested

Comments

@liuJchun
Copy link

Description

this is a bug?
desc: the gap now work when loading,only work when loaded completely
image
image

Steps to check or reproduce

use @egjs/react-grid package will show this problem

@malangfox malangfox self-assigned this Mar 29, 2023
@malangfox malangfox added the question Further information is requested label Mar 29, 2023
@daybrush
Copy link
Member

@liuJchun

Probably because batching doesn't happen while loading
The following phenomena may occur.

Try to set data-grid-lazy="true" on item element?

@malangfox malangfox removed their assignment Mar 30, 2023
@stepanjakl
Copy link

Hi, I'm encountering an issue with columns in which one of the columns with a percentage width doesn't have enough space to fill out its spot when the gap option is set.

Here's a pen.

@daybrush
Copy link
Member

daybrush commented May 9, 2023

@stepanjakl

align: 'justify', independent of gap.

If so, change it to align: "center", "start", "end".

@stepanjakl
Copy link

Hi @daybrush, even if I align the columns differently, the layout is not correct. There should be 3 columns instead of 2 as each column has width of 33.333%. Please see the example in the previous message. Preferably, the script should take column width into consideration when calculating the gap?

@daybrush
Copy link
Member

daybrush commented May 9, 2023

@stepanjakl

33.333%, so the sum of the three is 100%.
Therefore, it is difficult to set the gap to 30 (set 0).

@stepanjakl
Copy link

Yes, but if I set gap to 0 then there'll be no gap between the columns. I was hoping the script would calculate the gap taking column width into consideration. Does it make sense?

@stepanjakl
Copy link

I did sort it out this way btw:

<div class="w-full md:w-[calc(50%-(1rem/2))] lg:w-[calc(33.333333%-(1rem/(3/2)))]{% if loop.index === 1 %} lg:pt-40{% elseif loop.index === 3 %} lg:pt-20{% endif %}">

But this is not an ideal solution. The grid library should ideally compute the gap without me adjusting the column width.

@daybrush
Copy link
Member

daybrush commented May 9, 2023

@stepanjakl

It can't be helped because you set the width yourself.

If you expect to automatically change the width, try setting it with the following option. Instead, you must input the column value directly.

columns: 3,
gap: 30;
align: "stretch",

@stepanjakl
Copy link

Okay, I tried it, but it's overflowing its parent container now. Moreover, is there a way to set column breakpoints for different viewport widths?

Screenshot 2023-05-09 at 11 53 04

@daybrush
Copy link
Member

daybrush commented May 9, 2023

@stepanjakl

image

Try modifying align to "stretch".

@stepanjakl
Copy link

Ouh nice, that works, thanks! :)

One more question, how to handle responsivity when it comes number of columns or gap width?

@daybrush
Copy link
Member

daybrush commented May 9, 2023

@stepanjakl

Modify the column value directly through resize event or resizeObserver.

grid.column = 2 ~ 4

@stepanjakl
Copy link

Awesome, thank you. It's great library in any case.

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

No branches or pull requests

4 participants