Hi
Thanks for the good work, this is a great library!
I'm new to Muuri, and stuck in a situation where I need to dynamically change the width of some of the items, meaning different items have different width. Since they all have position: absolute, changing the width of one of them will make it overlap with the next.
My question: is there a good way to re-render the grid after a width of an item is changed, so no overlapping occurs, and the items are sorted without overflowing the container?
Thanks and regards
grid.refreshItems().layout(). And to optimize that further you can provide an array of items/elements as an argument for the refreshItems so that it only refreshes the items that you want to instead of refreshing all items.
Thanks a lot!
This solves the the re-rendering and sorting problem with overlapping.
I would like to ask another question if possible (yes, I know this is not a support forum, and sorry about this).
I'm initializing Muuri on dynamic elements that aren't existing on page load, and since the width change of items happens outside this scope, I'm loosing the context (Muuri instance) where the refresh (grid.refreshItems().layout()) should be fired. Is there any good approach to get the instance of the for dynamically generated elements?
Thanks again!
Hmmm... not quite following. Can you please share an example of this problem? And maybe it would be better that you create another ticket for this since it's a different issue. And close this one if the original problem was solved.
This issue seems to be resolved -> closing.
Most helpful comment
grid.refreshItems().layout(). And to optimize that further you can provide an array of items/elements as an argument for therefreshItemsso that it only refreshes the items that you want to instead of refreshing all items.