Phillip Garrett
Top achievements
Rank 1
Phillip Garrett
asked on 18 Jun 2010, 09:27 AM
Hi,
Using ScrollIntoView with SelectedItem always places the selected row at the bottom of the visible grid. Is there a way to have the SelectedItem appear at the top of the visible grid after scrolling into view?
Thanks,
Phill
5 Answers, 1 is accepted
0
Hello Phillip Garrett,
This is the default behavior of RadGridView by design . Still it is possible to achieve what you request , but it will involve some pretty ugly hacks . Let me know in case you decide to go that way and I will try to prepare a small sample for you.
All the best,
Pavel Pavlov
the Telerik team
This is the default behavior of RadGridView by design . Still it is possible to achieve what you request , but it will involve some pretty ugly hacks . Let me know in case you decide to go that way and I will try to prepare a small sample for you.
All the best,
Pavel Pavlov
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
Phillip Garrett
Top achievements
Rank 1
answered on 18 Jun 2010, 09:57 AM
Please can you show me the ugly hack :)
Thanks,
Phill
Thanks,
Phill
0
Hi Phillip Garrett,
Here you are:
This method will scroll the Item intto view and place it on the top.
The hack is based on the fact that if the Item comes from above the view port is always placed at the top . So what we actually do is - first scroll to the end , then scroll to the item .
The result - the item finally is on top.
Best wishes,
Pavel Pavlov
the Telerik team
Here you are:
private
void
ScrollItemToTop(
int
itemIndex)
{
this
.RadGridView1.ScrollIntoViewAsync(
this
.RadGridView1.Items[RadGridView1.Items.Count - 1],
f =>
{
this
.RadGridView1.ScrollIntoView(
this
.RadGridView1.Items[itemIndex]);
}
);
}
This method will scroll the Item intto view and place it on the top.
The hack is based on the fact that if the Item comes from above the view port is always placed at the top . So what we actually do is - first scroll to the end , then scroll to the item .
The result - the item finally is on top.
Best wishes,
Pavel Pavlov
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
Marc Roussel
Top achievements
Rank 2
answered on 06 Oct 2010, 07:23 PM
How would you convert this
rgvJobs.SelectedItem = Job;
rgvJobs.ScrollIntoView(Job);
Into this :
rgvJobs.ScrollIntoViewAsync(Job, f =>
{
// What do I put here ?
});
0
Hi Marc Roussel,
This should work:
Regards,
Veselin Vasilev
the Telerik team
This should work:
rgvJobs.ScrollIntoViewAsync(Job, f =>
{
rgvjobs.ScrollIntoView(Job);
});
Regards,
Veselin Vasilev
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