This is a migrated thread and some comments may be shown as answers.

Automatic resizing of MVC grids with splitter controls

2 Answers 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tor
Top achievements
Rank 1
Tor asked on 11 Jul 2012, 02:09 PM
In my project I have two MVC grids separated by a horizontal splitter control. I would like the grids to dynamically resize based on the available space as I move the splitter up or down. Is this possible? So far I haven't been able to specify a dynamic height since the grids seem to require a fixed pixel height?

Basic layout:
Grid1
************************* Splitter control should resize grids as I move it up or down
Grid2

Best regards
Tor

2 Answers, 1 is accepted

Sort by
0
Pedro
Top achievements
Rank 2
answered on 11 Jul 2012, 04:52 PM
Show us what you have and we can go from there.

Thanks,

Pedro
0
Tor
Top achievements
Rank 1
answered on 11 Jul 2012, 04:58 PM
I basically ended up adding the following JS method to the splitter's OnResize event

function ResizeStackedGrids(offsetTopGrid,offsetBottomGrid) {
    var topGrid = $($('#horizontalSplitter').children()[0]);
 
    var bottomGrid = $($('#horizontalSplitter').children()[2]);
 
    if (topGrid && bottomGrid) {
        $(topGrid).find(".myGrid").find(".t-grid-content").height(topGrid.height() - offsetTopGrid);
        $(bottomGrid).find(".myGrid").find(".t-grid-content").height(bottomGrid.height() - offsetBottomGrid);
    }
}
This seems to do the trick
Tags
Grid
Asked by
Tor
Top achievements
Rank 1
Answers by
Pedro
Top achievements
Rank 2
Tor
Top achievements
Rank 1
Share this question
or