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

Re-Sorting Columns causes data to disappear?

4 Answers 189 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 05 Oct 2011, 02:22 PM
Hello all,

    I am working with a Telerik grid that loads Employee data with multiple columns. The grid loads Employee information based on a ClientId. The data in the grid loads and displays just fine when I initially open the grid. However, after selecting a column header to re-sort the column (either in ascending or descending order), the data seems to disappear. Our team has recently updated our Silverlight app from the Trial Version. I wasn't sure if this would cause any type of problem because re-sorting a particular column seemed to work fine with the trial version. Let me know if you have any ideas, thanks.

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 05 Oct 2011, 02:24 PM
Hi,

 Can you post the grid version? More info about how exactly the grid is bound and/or any custom xaml/code will be helpful as well. 

Best wishes,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Jeff
Top achievements
Rank 1
answered on 05 Oct 2011, 02:39 PM
Yes the itemsource is bound to a CollectionView..

The the viewmodel consists of a loading method that consists of .. 
  
if (client != null)
            {
                EmployeeSearchService.Clear<EmployeeBasic>();
  
                //Performs a paged load of the employee list of data.
                Action<int> pagedLoad = null;
                pagedLoad = (skip) =>
                    {
                        var filter = new QueryBuilder<EmployeeBasic>()
                            .Where(e => e.ClientId == client.ClientId && e.Status == "Active")
                            .OrderBy(e => e.FullName)
                            .Skip(skip)
                            .Take(TAKE);
  
                        filter.RequestTotalItemCount = true;
  
                        EmployeeSearchService.LoadEmployeeBasic(filter)
                               .Subscribe((slr) =>
                               {
                                   if (slr.TotalEntityCount > TAKE)
                                   {
                                       pagedLoad(skip + TAKE);
                                   }
                               });
                    };
  
                pagedLoad(INITIALSKIP);
            }

This again, seems to work just fine when the grid is initially open. It just disappears when re-sorting the column to ascending/descending order. In order to re-retrieve the data to be seen in the grid, I have to select a new clientId.

The XAML for the fomation of the grid looks like...
                  <telerik:RadGridView x:Name="radGridView"
                                 Grid.ColumnSpan="2"
                                 HorizontalAlignment="Stretch"
                                 AutoGenerateColumns="False"
                                 DataLoadMode="Asynchronous"
                                 IsFilteringAllowed="True"
                                 IsReadOnly="True"
                                 ItemsSource="{Binding Employees}"
                                 RowIndicatorVisibility="Collapsed"
                                 ShowGroupPanel="False">


The XAML for a specific the name column for example looks like..
<telerik:GridViewDataColumn DataMemberBinding="{Binding ClientId}"
                                                Header="{Binding Strings.ClientId,
                                                Source={StaticResource EmployeeResources}}"
                                                IsSortable="True" />
0
Vlad
Telerik team
answered on 05 Oct 2011, 02:51 PM
Hello Jeff,

 Please remove DataLoadMode="Asynchronous" - your service is already asynchronous and you do not need this setting. 

Best wishes,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Jeff
Top achievements
Rank 1
answered on 05 Oct 2011, 03:20 PM
Vlad,

   Problem solved! Thank you very much.
Tags
GridView
Asked by
Jeff
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or