dhtmlxgrid height depending on window height

Hello,



I’ve to change the dhtmlxgrid’s height after a window resize. But the height must be computed.

Is there a way to set of the grid’s height with a formula or something else ?


Hello,


grid adjusts its sizes to the sizes of its parent contain when window resizes. So please check that grid container size changes (the size is set in percent).


In common case you can change the sizes of grid conatiner and the grid.setSizes() to adjust grid sized.

Thank you for your answer.

I’ve a small problem : while I resize slowly the window, the bottom’s grid flashes (see exemples file).
It’s possible to avoid this ?

dhtmlxgrid.zip (415 KB)


The reason for the problem is resize event handler that you have set. Try to use the following instead:


var _resize_timer

$(function(){
$(window).resize(function(){
window.clearTimeout(_resize_timer);
_resize_timer=window.setTimeout(function(){
setGridHeight();
}, 100);
});
});




function setGridHeight() {
h = $(window).height();
h -= Math.round($(’#gridbox’).position().top);
h -= 150;
$(’#gridbox’).height(h);
mygrid.setSizes();
}

above function works fine and resizes the grid when window resize function is called, but it is failed when we use freeze column functionality.

mygrid.splitAt(3);

if we use above function for freezing some columns then auto resize functionality stops working.

please advice in this regard.

Thanks.

Try to use

$('#gridbox').height(h); mygrid._fake.entBox.style.height = h+"px"; //set height for split area mygrid.setSizes();

Dear i try its not working
is there some thing in css that need to be fix.

Thanks.

Can you provide a sample or demo link, where issue can be checked.
Normally you need not any extra code - changing container height and calling setSizes after that must be enough

Please have at the attached file aspx and data source xml file
test_list_1.zip (1.99 KB)
TreeGridTest.zip (7.04 KB)

Check the update sample

  • height of grid was changed to 100% instead of fixed value
  • when sizing by js - height set to the parent container of gridbox
    TreeGridTest.zip (13.8 KB)

Thank you dear for your kind support.
it is working.

Thanks.

Thank you dear for your kind support.
it is working.

Thanks.