Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

resizeCanvas doesn't work when slick grid is collapsed

I have a accordion which collapse a slick grid. I am trying to resize my slick grid when I make the page smaller. Everything is working when the grid is opened but if the grid is collapsed and when i change the size of the page then click the accordion the data does not display correctly in slick grid.

$(window).resize(function () {
            grid.resizeCanvas();               
        });
like image 973
Nakres Avatar asked Nov 23 '25 21:11

Nakres


1 Answers

I finally found a solution for that.

<div id="accordion">
        <h3>Credits</h3>
        <div id="griddiv">
            <div id="grid" data-bind="slickGrid: { data: items, columns: columns }"></div>
        </div>
</div>

$(window).resize(function () {
        grid.resizeCanvas();

});

$('#griddiv').on('shown', grid.resizeCanvas)

$("#accordion").click(function () {
        grid.resizeCanvas();
});
like image 139
Nakres Avatar answered Nov 26 '25 11:11

Nakres



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!