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

[Help] Problem about pressing tab key, Horizontal scroll of the gridview's header doesn't work

7 Answers 196 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Truong
Top achievements
Rank 1
Truong asked on 20 Apr 2011, 05:13 AM
In footer of the gridview, I have some textboxs. When I use horizontal scroll,
then header and footer will move on following this horizontal scroll.
But when I use tab key to move to next textbox (instead of using horizontal scroll) then footer, header and items don't move on following.
Please help me to resolve this problem.
Thank!!!

7 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 22 Apr 2011, 09:54 PM
Hi Truong,

Can you please specify if you have set the RadGrid1.ClientSettings.Scrolling.FrozenColumnsCount property to a value greater than 0?

Please note that when frozen columns are used, tabbing between the textboxes in an inline edit form is not supported out-of-the-box, because the frozen columns will be scrolled together with the non-frozen. In selected scenarios, this functionality can be achieved if you subscribe to the textboxes' focus events and scroll a specific <div> with Javascript. This <div> has a client ID of "..._Frozen" where "..." is the RadGrid client ID. When doing this, you should take into account the current scroll position, and the width of the column that should be hidden/shown.

Kind regards,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Charles
Top achievements
Rank 1
answered on 02 Jul 2013, 01:20 PM
is there any example code for this workaround of scrolling the div's with '...frozen' ???
0
Pavlina
Telerik team
answered on 05 Jul 2013, 08:21 AM
Hi Charles,

The frozen columns functionality is implemented by hiding the RadGrid "real" scrollbar (used with the scrolling with static headers) and using a "fake" one, which triggers some columns to be hidden and shown, depending on the scrollbar position. However, when you start tabbing through the textboxes, you are beggining to scroll the complete RadGrid data area, including the frozen columns. In other words, this is the same as scrolling the "real" hidden scrollbar. This is the cause tabbing and frozen scrolling to be not supported.

However, there is a workaround which works in a few scenarios. You should keep in mind that this is a custom code which is not universal and it will not work in all scenarios:
function OnGridCreated(sender, args)
{
    var frozenScroll = $get(sender.get_id() + "_Frozen");
    var allColumns = sender.get_masterTableView().get_columns();
    var scrollLeftOffset = 0;
    var allColumnsWidth = new Array;
    var grid = sender.get_element();
    for (var i = 0; i < allColumns.length; i++)
    {
        allColumnsWidth[i] = allColumns[i].get_element().offsetWidth;
    }
 
    $get(sender.get_id() + "_GridData").onscroll = function (e)
    {
        for (var i = 0; i < allColumns.length; i++)
        {
            if (!allColumns[i].get_visible())
            {
                scrollLeftOffset += allColumnsWidth[i];
            }
            if ($telerik.isIE7)
            {
                var thisColumn = grid.getElementsByTagName("colgroup")[0].getElementsByTagName("col")[i];
                if (thisColumn.style.display == "none")
                {
                    scrollLeftOffset += parseInt(thisColumn.style.width);
                }
            }
        }
        var thisScrollLeft = this.scrollLeft;
        if (thisScrollLeft > 0)
            frozenScroll.scrollLeft = thisScrollLeft + scrollLeftOffset + 300;
        this.scrollLeft = 0;
        scrollLeftOffset = 0;
    }
}

 

Regards,
Pavlina
Telerik
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 the blog feed now.
0
MRa
Top achievements
Rank 1
answered on 07 Aug 2013, 10:10 PM
This works fine on item edit, is there any way i could apply this when a row is inserted or copied?
0
Eyup
Telerik team
answered on 12 Aug 2013, 11:48 AM
Hello Mery,

Can you please open a support ticket to send us a very basic sample runnable web site demonstrating the behavior? Thus, we will be able to figure out your specific scenario and suggest a proper solution.

Regards,
Eyup
Telerik
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 the blog feed now.
0
Charles
Top achievements
Rank 1
answered on 12 Aug 2013, 01:34 PM
Pavlina,

Thanks for the sample code. Unfortunately, even with using the mouse to scroll, we were never able to develop a 'usable' solution as there were just too many instances of columns being inaccessible or hidden from view. 

We have abandoned the use of the frozen columns and will probably not revisit them until we have more time to fully develop a workable solution.

Thanks,

Charlie
0
Max
Top achievements
Rank 1
answered on 25 Feb 2019, 03:57 AM
I have same problems. But i dont understand that javascript code. My code skill not well.
Can you explain javascript to me?
--------------------------------------------------------
RadGrid ID==>RadGridSalList

   protected void Time_TextChanged(object sender, EventArgs e)
        {

    TextBox a = (TextBox)sender;
  GridDataItem Item = (GridDataItem)a.NamingContainer;
  if (a.ID == "TBCWYearVal" || a.ID == "TBCWNYearVal")
            {
                ((TextBox)Item.FindControl("TBCYearVal")).Text = #blabla.ToString();


            }
if (a.ID == TBNTimeHour )
            {
                 ((Literal)Item.FindControl("LTNTimeVal")).Text = #blabla.ToString();


            }
if (a.ID == TBOTimeHour)
            {
                 ((Literal)Item.FindControl("LTOTimeVal")).Text = #blabla.ToString();


            }
Tags
Grid
Asked by
Truong
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Charles
Top achievements
Rank 1
MRa
Top achievements
Rank 1
Eyup
Telerik team
Max
Top achievements
Rank 1
Share this question
or