This question is locked. New answers and comments are not allowed.
Hi Guys,
I faced issue with GridView and Child table - somehow child shows only 58 records. Idea is that Customer has list of Sites, and child table shows only 58 site.... must show 100, as I load 100 sites for each customer... Well, this is just example (i can upload test project)...
Pls have a look ...Looks like it is bug..
This is ViewModel:
This is my Code Behind to emulate LoadOnDemand behavior...
I faced issue with GridView and Child table - somehow child shows only 58 records. Idea is that Customer has list of Sites, and child table shows only 58 site.... must show 100, as I load 100 sites for each customer... Well, this is just example (i can upload test project)...
Pls have a look ...Looks like it is bug..
<telerik:RadGridView ItemsSource="{Binding PagedSource,ElementName=radDataPager}" RowIsExpandedChanging="RadTreeListView_RowIsExpandedChanging" RowLoaded="RadTreeListView_RowLoaded"> <telerik:RadGridView.ChildTableDefinitions> <telerik:GridViewTableDefinition/> </telerik:RadGridView.ChildTableDefinitions> <telerik:RadGridView.HierarchyChildTemplate> <DataTemplate> <telerik:RadGridView ItemsSource="{Binding Sites}"/> </DataTemplate> </telerik:RadGridView.HierarchyChildTemplate> </telerik:RadGridView> This is ViewModel:
public class VM : ModelBase { private ObservableCollection<CustomerSearchResult> _Customers = new ObservableCollection<CustomerSearchResult>(); public ObservableCollection<CustomerSearchResult> Customers { get { return _Customers; } set { if (_Customers != value) {_Customers = value; RaisePropertyChangeEvent("Customers");} } } //Here we load 100 record in main/parent table public void LoadCustomers() { for (int i = 0; i < 100; i++) { var csr = new CustomerSearchResult() { Firstname = "Name" + i.ToString(), SiteCount = i }; Customers.Add(csr); } } //and here we load child items. lets load 100 as well public void LoadSite(CustomerSearchResult customer) { for (int i = 0; i < 100; i++) { customer.Sites.Add(new SiteModel() { Commodity = "My commodity" + i }); } }This is my Code Behind to emulate LoadOnDemand behavior...
private void RadTreeListView_RowIsExpandedChanging(object sender, RowCancelEventArgs e) { var csr = e.Row.Item as CustomerSearchResult; if (csr != null && csr.SiteCount > 0 && csr.Sites.Count == 0) { vm.LoadSite(csr); } } private void RadTreeListView_RowLoaded(object sender, RowLoadedEventArgs e) { GridViewRow row = e.Row as GridViewRow; var csr = e.Row.Item as CustomerSearchResult; if (row != null && csr != null) { row.IsExpandable = csr.SiteCount > 0 ? true : false; } }