Categories | Question details Back To List | ||||||||||||||
Changing the height of the grid dynamically Can I change the height of the grid when the browser window is resized so that my footer is always at the bottom of the window? (The width automatically changes correctly). Thanks, Ben Answer posted by Stanislav (support) on Oct 15, 2009 03:55 If you have height of grid defined in percents - grid will adjust it to height of surrounding container after browser's resize. Answer posted by Ben Leah on Oct 15, 2009 03:56 This doesn't seem to be the case, I have dynamic smart rendering on , would this make a difference? Answer posted by Stanislav (support) on Oct 15, 2009 04:58 In case of SRND mode grid may have some white-space not filled with rows, while resizing from smaller size to bigger one, but the sizes of grid on the page will be calculated correctly without relation to the modes of grid. If necessary , we can provide some kind of a sample. Answer posted on Oct 15, 2009 04:59 Yes, please show me an example, I have the height of the grid container set 100% but when I resize the window (browser) the height does not change. Thanks, Ben Answer posted by Stanislav (support) on Oct 15, 2009 06:04 Sample is attached to the post. Attachments (1)
Answer posted by Ben Leah on Oct 15, 2009 07:03 Hi, Ok I have found the problem, if I include the following doctype in my page (using a height of 100%).. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> The grid does not display correctly, only the headers display but the rows do not. Is there a workaround for this (apart from taking out the doctype?) Thanks, Ben Answer posted by Stanislav (support) on Oct 15, 2009 07:39 Sorry, was a my typo in the sample Change <style type="text/css" media="screen"> /* fixing body's height in standard mode */ html body{ as <style type="text/css" media="screen"> /* fixing body's height in standard mode */ html, body{ and it will work with all doctypes Answer posted by Ben Leah on Oct 15, 2009 08:11 Hi, Thanks for that but I am unable to set 100% height on the body of the page, I have a <div> above the grid which has a fixed height of 300px, if I put the grid in its on container and set the height of that to 100% the grid drops of the bottom of the page? If I try dynamically resizing the containing div the grid does not resize with it? Thanks, Ben Answer posted by Stanislav (support) on Oct 16, 2009 03:57 Can you please provide the html snippet, used in problematic case. Answer posted by Ben Leah on Oct 16, 2009 08:26 I have the grid resizing ok now thanks by setting the height of the surrounding div programitically. Although now I have a problem when I am recreating the grid without a browser refresh. I use the destructor before recreating the grid but then if I re-size the browser window the grid no longer resizes correctly? Answer posted by Ben Leah on Oct 19, 2009 02:17 I have attached an example of the problem I have. If you resize the browser window and click the resize button the grid should change the height of the browser window ( minus the offset). This works fine in Firefox but not in IE8, do you have any suggestions to make this work? Thanks, Ben Attachments (1)
Answer posted by Stanislav (support) on Oct 19, 2009 07:22 During initialization grid clears initial width and height settings from the container. So when the second grid is initialized in the same container , there is not height and width settings, which are enabling auto-size first time. To fix the problem, change the reloading code as mygrid.destructor(); var obj = document.getElementById("gridbox"); obj.style.width = "100%"; obj.style.height = "100%"; mygrid = new dhtmlXGridObject('gridbox'); |