I am trying to build a page that has a panel at the top for a filter and a grid underneath in a second panel. The top panel has a hide button. I wish to make the grid bigger when the filter is hidden. I can change the height of the panel containing the grid with Async calls or javascript but I cannot change the height of the grid. Is there a way to change the height of a AdvDBGrid at runtime using Javascript or an Async call to the server?
Sorry, I was a bit vague. As indicated, I am trying to have a grid fill a space in the browser that expands when a region above it is hidden.
Here is what I have tried.
Try adding a TIWRegion to a form about 500 pixels high (IWRMain) Then add two TIWRegions inside this. The top is called IWRTop and is alTop and about 100 pixels high. The second is called IWRGrid and is alClient to fill the remainder of the box.
Then add a DBAdvWebGrid to the IWGrid Region. Set the datasource and AutoAddAllFields to true Set UseFullWidth and UseFullHeight to true Set Scroll.Style to scAuto (I do this because a scrolling grid where the titles disappear is not appropriate) Set RowCount=50 Set Alignment to alClient Set the color of the IWRGrid to clred.
Add a button in IWTop with an Async click to IWRMain.height=IWRMain.Height+100; Add a second button in IWTop with an Async click to IWRTop.Visible := not IWRTop.VIsible;
Run the app. I get two sets of scroll bars and the grid does not grow with the parent region on clicking either button. It does move up when the panel is hidden.
Change alignment to none and set the four anchors to true. Shrink the grid to slightly smaller than the region. This removes unwanted scroll bars on the region. The grid still does not expand.
It is likely I am approaching this the wrong way. Please let me know what I have done wrong.
I thought it would be just a case of hiding the top region and the other would expand to fill the remaining space??
Is there a way I can send you the source if you need it?