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

Does vertical scroll shown in grid?

9 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Covertix
Top achievements
Rank 1
Covertix asked on 08 Apr 2012, 01:10 PM
Hi,

Is there a way to determine if a vertical scroll bar shown in the grid?

Thanks.

9 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 08 Apr 2012, 06:39 PM
Hello Tzach,

please check below demo/link.
Grid / Scrolling

Thanks,
Jayesh Goyani
0
Covertix
Top achievements
Rank 1
answered on 09 Apr 2012, 09:07 AM
Thanks for your reply, but it is not what I've meant.
I know how to use scrolling.
I want to determine if the vertical scroll is shown or not.

If there are 2 items, then the scroll won't be shown (their height is less than the scroll height),
but if there are 30 items, for example, than the scroll will be shown.

Is there a way to calculate, or to get property that says if the scroll is shown or not?
0
Tsvetina
Telerik team
answered on 11 Apr 2012, 07:53 PM
Hello Tzach,

You can use client script to check the height of the scrollable are in RadGrid and if it exceeds the height that you have set, then a scroll bar is visible.

1) If you do not use static headers, check if gridInstance.get_element().clientHeight is more than the Height that you have specified for RadGrid.

2) If you use static headers, check if gridInstance.GridDataDiv.clientHeight is more than the ScrollHeight that you have specified for RadGrid.

I hope this helps.

Regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Covertix
Top achievements
Rank 1
answered on 18 Apr 2012, 10:44 AM
Hi Tsvetina,

Thank you for your replay.
How can I know in client side that the page size was changed?
I can't find any client event for this operation.

Thanks!
0
Tsvetina
Telerik team
answered on 20 Apr 2012, 03:33 PM
Hi Tzach,

The client-side OnCommand event will fire when the page size is changed:
OnCommand

Greetings,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Covertix
Top achievements
Rank 1
answered on 22 Apr 2012, 03:04 PM
Hi Tsvetina,

I tried , but the event doesn't fire when PAGE SIZE is changed. (it is fired when changing page..).
Do you know another event that can help me?

Thank you very much..
0
Tsvetina
Telerik team
answered on 25 Apr 2012, 01:07 PM
Hello Tzach,

You can also try attaching the OnClientSelectedIndexChanged event of the pagesize combo:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridPagerItem)
    {
        RadComboBox comboPageSize = (RadComboBox )e.Item.FindControl("PageSizeComboBox");
        comboPageSize.OnClientSelectedIndexChanged= "pageSizeChanged";
    }
}

javascript:
function pageSizeChanged(sender, args)
{
    //sender is the combo box
}

I hope this helps.

All the best,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Covertix
Top achievements
Rank 1
answered on 29 Apr 2012, 08:49 AM
Hi Tsvetina,

I cannot find the control with the name you gave me (PageSizeComboBox).

The line:
RadComboBox comboPageSize = (RadComboBox )e.Item.FindControl("PageSizeComboBox");

always returns null object.

Thanks.
0
Covertix
Top achievements
Rank 1
answered on 30 Apr 2012, 10:26 AM
Hi Tsvetina and thanks for your help.
I solved the problem.

What I did, is to check when GridCreated event is called, if the data height is greater than the scroll height.

function GridCreated (sender, args)
{
    var dataHeight = sender.get_masterTableView().get_element().clientHeight;

    
    if (dataHeight > scrollHeight)
    {
        //There is a vertical scroll
    }

}


 


Tags
Grid
Asked by
Covertix
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Covertix
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or