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

[Solved] OnScroll not firing if there are frozen columns

11 Answers 339 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 25 Jun 2010, 02:40 AM
I am creating a grid dynamically and setting client events in code behind. If I freeze any columns the OnScroll client event does not fire for horizontal scroll. It continues to fire for vertical but not horizontal.  Is this a bug? As soon as I comment out line three the event fires.

currentGrid.ClientSettings.ClientEvents.OnScroll =

"Scroll";

 

currentGrid.ClientSettings.Scrolling.UseStaticHeaders =

 

true;

 

currentGrid.ClientSettings.Scrolling.FrozenColumnsCount = 2;

Thanks,
Sean

 

11 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 25 Jun 2010, 03:59 PM
Hi Sean,

Could you please confirm that you are using 2010.1 519 version of RadControls for ASP.NET AJAX in your project?

Kind regards,
Pavlina
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
0
Sean
Top achievements
Rank 1
answered on 25 Jun 2010, 04:49 PM
I'm using version 2009.3.1103.35
0
Sean
Top achievements
Rank 1
answered on 28 Jun 2010, 08:26 PM
Any comments regarding my version. Is this a bug and if so is there a hotfix?
0
Pavlina
Telerik team
answered on 29 Jun 2010, 03:15 PM
Hi Sean,

When using frozen columns, there is one <div> with a "fake" scrollbar, which does not actually scroll the RadGrid columns, but causes them to hide and show (otherwise it is not possible to keep frozen columns always visible). Therefore it is expected OnScroll client-side event not firing.

Regards,
Pavlina
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
0
Sean
Top achievements
Rank 1
answered on 29 Jun 2010, 03:56 PM
You might want to mention that in your documentation before you have people waste hours researching the issue. So you are telling me it is "expected"? That an event is not expected to fire if an option is enabled? This is an absolute bug in my mind. How am I to persist the horizontal scroll when columns are frozen? You offer no solution just that its expected to happen. Is the RadGrid not capable of this? 
0
Pavlina
Telerik team
answered on 30 Jun 2010, 10:40 AM
Hello Sean,

To subscribing to the onscroll event of the fake scrollbar element ($get(sender.get_id() + "_Frozen")), you should also subscribe to the onscroll event of the data area wrapper.

You can subscribe to the onscroll event as demonstrated below.
<telerik:RadGrid
    ID="RadGrid1"
    runat="server"
    Width="600px"
    OnNeedDataSource="RadGrid1_NeedDataSource">
    <ClientSettings>
        <Scrolling AllowScroll="true" UseStaticHeaders="true" FrozenColumnsCount="1" />
        <ClientEvents OnGridCreated="MyGridCreated" />
    </ClientSettings>
</telerik:RadGrid>
   
<script type="text/javascript">
   
function MyGridCreated(sender, args)
{
    var frozenWrapper = $get(sender.get_id() + "_Frozen");
    if (frozenWrapper)
        $addHandler(frozenWrapper, "scroll", gridscroll);
}
   
function gridscroll(e)
{
    document.title = new Date();
}
   
</script>

I hope this help.

Kind regards,
Pavlina
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
0
Sean
Top achievements
Rank 1
answered on 30 Jun 2010, 08:54 PM
How would I get the position x and y or scrollLeft  and scrollTop of that div within the gridScroll(e) event? I need to be able to persist that to a cookie and when the grid is rebinded reposition the grid back to the original scroll coordinates.

Thanks so much for your help, we are really close.
0
Pavlina
Telerik team
answered on 06 Jul 2010, 02:42 PM
Hello Sean,

Please refer to the attached project for more information about how to achieve the desired result. Give it a try and let me know if it helps.

Kind regards,
Pavlina
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
0
Rob
Top achievements
Rank 1
answered on 13 Jul 2013, 02:00 PM
Is there any update to this.  I tried this example technique but e.clientX is "undefined"
0
Venelin
Telerik team
answered on 16 Jul 2013, 05:40 PM
Hi Rob,

We addressed your issue in the support ticket that you have opened.
Also if someone else gets undefined for e.clientX you can use the following approach instead:

function onGridCreated(sender, args) {
    var frozenWrapper = $get(sender.get_id() + "_Frozen");
    if (frozenWrapper) {
        $addHandler(frozenWrapper, "scroll", onscroll);
    }
}
  
function onscroll(e) {
    console.log(e.target.scrollLeft);
}

I hope this helps.

Regards,
Venelin
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
Rob
Top achievements
Rank 1
answered on 16 Jul 2013, 06:32 PM
This works, thank you!
Tags
Grid
Asked by
Sean
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Sean
Top achievements
Rank 1
Rob
Top achievements
Rank 1
Venelin
Telerik team
Share this question
or