async loading

4 posts, 0 answers
  1. john
    john avatar
    6 posts
    Member since:
    Jan 2011

    Posted 15 Jan 2011 Link to this post

     

    We are trying to use the treelistview in on demand loading much like your example 

    in the demos.. Our data comes from a web service call and we are running into 2 show stoppers. The most troubling is wrong insertion of child nodes into the tree as a result of an “out of the norm” design of our hierarchy that I will share later. My XAML is almost the same as your example

    <telerik:RadTreeListView x:Name="ConceptBankTreeView" RowLoaded="RadTreeListView_RowLoaded" RowIsExpandedChanging="RadTreeListView_RowIsExpandedChanging"

    Background="White" BorderBrush="{StaticResource TreeBorder1}"AutoGenerateColumns="False" HorizontalAlignment="Stretch"VerticalAlignment="Stretch" VirtualizingStackPanel.VirtualizationMode="Recycling" KeyDown="ConceptBankTreeView_KeyDown">  

    <telerik:RadTreeListView.ChildTableDefinitions>

    <telerik:TreeListViewTableDefinition x:Name="Child" ItemsSource="{Binding ChildConcepts}" />  

    </telerik:RadTreeListView.ChildTableDefinitions>  

    <telerik:RadTreeListView.Columns>

    <telerik:GridViewCheckBoxColumn Width="25" DataMemberBinding="{Binding Selected, Mode=TwoWay}" ></telerik:GridViewCheckBoxColumn>  

    <telerik:GridViewDataColumn DataMemberBinding="{Binding Display}" Header="Product ID" Width="160" >

    <telerik:GridViewDataColumn.CellTemplate>

    <DataTemplate>

    <TextBox x:Name="ConceptEditTxtBx" Text="{Binding Display,Mode=TwoWay}" Background="Transparent" BorderThickness="0" TextWrapping="Wrap" GotFocus="ConceptEditTxtBx_GotFocus" />  

    </DataTemplate

    </telerik:GridViewDataColumn.CellTemplate>  

    </telerik:GridViewDataColumn>

    things loads nicely as we load some data from the server  and s we set the ItemsSource (one time) to an ObservableCollection which reflects our hierarchy . we will later add child node list to this in a tree like manner.

    .ConceptBankTreeView.ItemsSource = OurObjectsHierachy;

     

     

     WE have the requirement to lazy load the child leafs as they are expanded by the user and I use following to do this: 

    void RadTreeListView_RowIsExpandedChanging(object sender, RowCancelEventArgs e)

    {

          ActiveConcept = e.Row.DataContext as ParentConceptDO;

          if (ActiveConcept != null )

               RequestChildrenInConceptBankDG(ActiveConcept,null);  

    }
    we call the method to get the data from the server and it ends up populating the ChildItems list in the

    ActiveConcept. so we see the child items but there an indentation issue as the treelist  seems to want to make sure
    the columns in the parent and child rows line up. But is there a way to turn this behavior off?

     Now we might be able to live with this but we also have child items that are also parents and therefore appear in the initial list of nodes. E.g

    my parents list is:
    Florida
    California
    New Mexico

    and if New Merico has as it child Florida we want to list to look like:
    Florida
    California
    New Mexico
        Florida

    but what we see is
    Florida
    Florida
    California
    >New Merxico

    so it expands New Mexico but puts the child is the top level! It has been assigned the wrong parent (it is null) and
    not NewMexico. I cannot see a way to programmatically set the parent of the row. Are we trying to something that your treelist cannot do, this would be a shame as it is almost there.

     

  2. john
    john avatar
    6 posts
    Member since:
    Jan 2011

    Posted 15 Jan 2011 Link to this post

    where is th RTF mode as this formatting is a mess
  3. DevCraft banner
  4. john
    john avatar
    6 posts
    Member since:
    Jan 2011

    Posted 18 Jan 2011 Link to this post

    we are a new customer and I convinced my client to use your tools and part of the reason was the support ... so far not impressed!
  5. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 19 Jan 2011 Link to this post

    Hello john,
    Please excuse me for the late answer.

    After taking a look at your code and explanations , I believe the root of the problems is having a single instance of an item present both as root item and as a child . Unfortunately RadTreeListView can not handle this scenario.

    As a solution I may recommend  a small refactoring to your data model so that for example the parent "Florida" item and the node "Florida" item display the same text, but are actually different instances e.g. Equals() would return false.  This is a prerequisite for the RadTreeListView to distinguish between them and build the hierarchy UI correctly.

    * Another alternative for me to further assist you on the issue would be having your project ( or a small repro) here to debug and apply the fixes necessary.

    Kind regards,
    Pavel Pavlov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top