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

Relf-reference using OA

1 Answer 24 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ubuntu
Top achievements
Rank 1
Ubuntu asked on 20 Apr 2011, 01:55 PM
Dear All,
I have the following implementation for treeview using EF4, I tried to do the same using OA but with no luck, here we go:
On EF4 dmx diagram I have the following setting for my group table:
Parent: 0..1 (Zero or One)
Children: * (Many)
which are define as association on the group table.

I then have this xaml for the itemtemplate
    <telerik:HierarchicalDataTemplate x:Name="ItemTemplate" ItemsSource="{Binding Children}">
    <Grid>
        <Grid.ColumnDefinitions>
        <ColumnDefinition Width="16"/>
        <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <TextBlock x:Name="Label" Text="{Binding groupname}" Grid.Column="1"/>
    </Grid>
</telerik:HierarchicalDataTemplate>
Also this is the treeview xaml showing the binding to the groupcollection
<telerik:RadTreeView x:Name="Treeofgroups" FontSize="11" Grid.Row="1"
    IsLineEnabled ="True"
    ItemTemplate="{StaticResource ItemTemplate}" 
    IsLoadOnDemandEnabled="True"
    LoadOnDemand="ItemExpanded"
    SelectedItem="{Binding CurrentSelected,Mode=TwoWay}"
    ItemsSource="{Binding GroupCollection,Mode=TwoWay}"         
</telerik:RadTreeView>

In my ViewModel I have a QueryableDomainServiceCollectionView<group> GroupCollection to hold the list of groups from the domainservice using the following method on the domainservice:
public IQueryable<group> Getgroups()
{
    return this.ObjectContext.group.Include("Children").Where(p => p.parentid == null || p.parentid == "");
}

I also have this method to get the subgroups when the treeview get expanded (loaded Ondemand);
public IQueryable<group> GetChildrenByParentID(string parentID)
{
    return this.ObjectContext.group.Include("Children").Where(p => p.parentid == parentID);
}

I can't do the same implementation on the OA domainservice.

How can I achieve this scenario in treeview & OA
.

Best regards





1 Answer, 1 is accepted

Sort by
0
Ubuntu
Top achievements
Rank 1
answered on 20 Apr 2011, 04:03 PM
Dear All,

Never mind, I mange to get it to work.
I just removed the .Include("Children") and everything else is just fine.

Best
Tags
TreeView
Asked by
Ubuntu
Top achievements
Rank 1
Answers by
Ubuntu
Top achievements
Rank 1
Share this question
or