flexmasonry icon indicating copy to clipboard operation
flexmasonry copied to clipboard

refresh method

Open V0IDNIL opened this issue 4 years ago • 1 comments

Hi, How would I use the refresh method? I've tried to refresh the grid with the click of a button, but that doesn't work.

const fm = FlexMasonry.init('.grid', {
    breakpointCols: {
        'min-width: 960px': 5,
        'min-width: 768px': 4,
        'min-width: 576px': 3,
        'min-width: 450px': 2,
    }
});

document.getElementById('refresh').addEventListener('click', function() {
    fm.refresh();
});

Could you please tell me what I'm doing wrong? Sorry, I'm having a very limited understanding of Javascript. My apologies for that.

Thank you Klaas

V0IDNIL avatar Aug 09 '19 12:08 V0IDNIL

So you can either use refreshAll:

FlexMasonry.refreshAll();

Or you can refresh an individual grid:

var grid = document.getElementById('my-grid');
FlexMasonry.refresh(grid);

gilbitron avatar Aug 28 '19 13:08 gilbitron