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

RadTreeListView.ScrollIntoView doesn't works

13 Answers 219 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Julian
Top achievements
Rank 1
Julian asked on 05 Jul 2011, 12:16 PM
Hi,

I faced with a problem that RadTreeListView.ScrollIntoView() doesn't works at all.

I need your support or workaround if so exist asap.

Thank you in advance,
Julian

13 Answers, 1 is accepted

Sort by
0
Julian
Top achievements
Rank 1
answered on 05 Jul 2011, 02:06 PM

0
Julian
Top achievements
Rank 1
answered on 06 Jul 2011, 08:52 AM
Hi again.

Let me provide you with exact steps that I'm trying to perform:

1. Select any item in the RadTreeListView hierarchy.
2. Store selection item (we have to know which item has been selected)
3. Perform changes on related data of selected item of the RadTreeListView (From one side of UI we have RadTreeListView and from other one related control with some info of selected item).
4. When changes has been performed - reload the data in RadTreeListView and select the item that was previously edited.

How to solve it ?

Julian.
0
Julian
Top achievements
Rank 1
answered on 06 Jul 2011, 12:52 PM
Would you please answer with any kind of feedback ?

regards,
Julian
0
Nedyalko Nikolov
Telerik team
answered on 07 Jul 2011, 03:55 PM
Hello Julian,

Generally radTreeListView.ScrollIntoViewAsync(item) should do the job.
If this doesn't help, please send me a small sample project which I can debug on my side in order to see what is going on?
Thank you in advance.

Greetings,
Nedyalko Nikolov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Julian
Top achievements
Rank 1
answered on 08 Jul 2011, 09:00 AM
Hi,

Well, let me shine a little bit more light on my problem.

Assume that I have the following code:

            this.radTreeListView.SelectionChanged += (s, e) =>
                {
                    if (this.radTreeListView.SelectedItem != null)
                    {
                        var yamlItem = this.radTreeListView.SelectedItem as YamlItem;
                        if (yamlItem != null && yamlItem.Type != SignalType.Subsystem)
                        {
                            // store selected item into variable
                            this.storedSelectedItem = this.radTreeListView.SelectedItem;
                        }
                    }
                };

Let's also assume that when collection of RadTreeListView is going to be changed we have to re-select the last selected item that we stored in local variable this.storedSelectedItem.

            this.radTreeListView.Items.CollectionChanged += (s, e) =>
                    {
                        this.radTreeListView.ScrollIntoViewAsync(this.storedSelectedItemnull);
                    };

Of course It doesn't works, becouse the old collection was replaced by the new collection, and this.storedSelectedItem has another HashCode, that's why this.radTreeListView.ScrollIntoViewAsync(this.storedSelectedItemnull); can't find such item in its collection.

Well, to solve this issue I would like to foreach throw the all existed items in the this.radTreeListView.Items, and when I find the item  that is equals to my stored item this.storedSelectedItem.SomeTextValue (I will compare these items by string value that has each item) and afterwords I call this method  this.radTreeListView.ScrollIntoViewAsync(this.storedSelectedItemnull);.

That was my idea how to solve it, but I need your support how to foreach throw the hierarchical data structure of this.radTreeListView.Items.

Maybe you have another solution how to solve it ?

Please need your advice ASAP !

Kind regards,
Julian

 

0
Nedyalko Nikolov
Telerik team
answered on 08 Jul 2011, 03:20 PM
Hi Julian,

The best approach should be if you can use one and the same HashCode for a single item. However iterating through RadTreeListView.Items collection should be easy, just keep in mind that different objects could be returned due to hierarchical nature of the data source. For example:

Parent1
    Child1
    Child2
Parent2
    Child3

Items will have 5 items ordered (Parent1, Child1, Child2, Parent2, Child3).
Let me know if this doesn't help.

Best wishes,
Nedyalko Nikolov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Julian
Top achievements
Rank 1
answered on 11 Jul 2011, 02:01 PM
Hi,

Please provide me with simple example.

Regards,
Julian
0
Julian
Top achievements
Rank 1
answered on 12 Jul 2011, 02:49 PM
Dear Support Team,

Would you be so kind to provide us with working example as soon as possible or/and any status of current issue.

Thank you in advance,
Julian
0
Accepted
Maya
Telerik team
answered on 13 Jul 2011, 09:34 AM
Hi Julian,

I am sending you a sample project illustrating a possible approach for iterating through the Items collection.
Let me know whether it corresponds to your requirements. 
 

Best wishes,
Maya
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Julian
Top achievements
Rank 1
answered on 14 Jul 2011, 07:43 AM
Hi Maya,

Thank you for solution.

The last question how to Expand concrete group where selected item is located ?

Thank you in advance.



0
Maya
Telerik team
answered on 14 Jul 2011, 08:46 AM
Hello Julian,

Generally, if you want to get the parent item, you can do it only at data level, i.e. you need to have a property for example connecting the parent and child elements. However, depending on your specific settings and requirements, the child items may not be available unless being expanded.  

Kind regards,
Maya
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Julian
Top achievements
Rank 1
answered on 14 Jul 2011, 01:17 PM
Hi Maya,

I have a property "Parent" in my data model that represent the Parent (Group) of items that are located under the Parent node. The question is how to use ExpandGroup (IGroup group). How to get IGroup according to my SelectedItem that is of type MyCustomDataCollection ?

I would appritiate if you could help me with that too :)

Thanks,
Julian
0
Maya
Telerik team
answered on 14 Jul 2011, 05:24 PM
Hello Julian,

Please excuse me if I am missing something, but as you are referring to expanding groups, I got a bit confused. Are you referring to a RadGridView or RadTreeListView control ? Generally, there are no groups in RadTreeListView. 
 

Best wishes,
Maya
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
TreeListView
Asked by
Julian
Top achievements
Rank 1
Answers by
Julian
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Maya
Telerik team
Share this question
or