DrBorrow
DrBorrow

Reputation: 958

slickgrid resizable not refreshing rows

It works wonderfully (everything resizes in unison) but the number of visible rows does not update until I scroll.

Is there a way to force the viewport to refresh?? grid.render does not work.

$(".container").resizable({
    alsoResize: ".grid, .slick-viewport",
    resize: function (event, ui) { }
});

$(".container").on("resize", function (event, ui) {
    dataView.refresh();
    grid.render();
});

Upvotes: 1

Views: 2743

Answers (2)

ghiscoding
ghiscoding

Reputation: 13194

You might also want to look at an answer I gave for an auto grid resize, it's auto-resizing with the viewport and so changing the size of your browser will be reflected on the grid size...
See it here: Slickgrid: Final column auto size to use all remaining space

Upvotes: 0

DrBorrow
DrBorrow

Reputation: 958

In case anybody has the same problem, the answer is grid.resizeCanvas();

The code now looks like this:

    $('.container').each(function () { // I have several grids + containers
       var gridID = $(this).attr('id'); // get the container ID
       $(this).resizable({
       // for some reason, there was a problem with $(this) - I had to use
       // an explicit reference by passing the container ID
           alsoResize: '#' + gridID + ' .grid, #' + gridID + ' .slick-viewport',
           resize: function (event, ui) { }
       });

       $('.container').on('resize', function (event, ui) {
           grid.resizeCanvas()
       });
    }

Upvotes: 6

Related Questions