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

ScrollHeight in hidden div

1 Answer 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 27 Oct 2010, 08:35 PM
I have a unique situation where a grid is inside of a div that is hidden by default and can be shown when something else is clicked on the page (All done thru javascript). The grid is inside this toggle div. I want to the ScrollHeight to be 250px but if the contents of the grid is less than 250px i want to size the grid to fit the contents. I have tried using examples like this one: http://www.telerik.com/help/aspnet-ajax/grdresizegridwithscrollingwhenlessdata.html but if the div is not already expanded/showing the size of the grid sets to 0px [the masterTable clientHeight] thus no content being shown. Any ideas on how to get this to work even if the grid is not "visible" on the screen at the time the data is bound?

<div style="display:none">
RAD GRID HERE
</div>

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 28 Oct 2010, 11:38 AM
Hi Justin,

Generally, you need to execute the repaint() method of the RadGrid client object after its parent <div> becomes visible.

http://www.telerik.com/help/aspnet-ajax/grid-repaint.html

Any other control layout adjustments must not be carried out while the control is inside a container hidden with display:none, because Javascript size calculations don't work in such cases (e.g. all offsetWidth properties return zero).

Regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Justin
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or