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

Sorting with pending changes and RIA fails

5 Answers 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 05 Jan 2011, 08:33 AM
I am currently getting the following error when sorting a grid bound to a RIA datasource when there are pending changes

Sorting cannot be applied when CanLoad is false. Applying sorting initiates a load operation, and load operations are not permitted when CanLoad is false.  Controls that apply sorting should be disabled when CanLoad is false.  

Also happens for grouping - filtering is fine.
This was not happening with the Q2 release

I was performing the following in the Q2 release to stop a call back
private void RadGridView_Sorting(object sender, GridViewSortingEventArgs e)
{           
    this.DataSource.LoadingData += this.SortRunCancelLoadingData;
}

private void RadGridView_Grouping(object sender, GridViewGroupingEventArgs e)
{
    this.DataSource.LoadingData += this.SortRunCancelLoadingData;
}
 
private void SortRunCancelLoadingData(object sender, LoadingDataEventArgs e)
{
    e.Cancel = true;
    this.DataSource.LoadingData -= this.SortRunCancelLoadingData;
}

in Q3 release, the SortRunCancelLoadingData method is never called and a call to server is never made - the sorting works fine until there are changes

if the sort is already applied, and the data is change the sort updates correctly

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 05 Jan 2011, 11:17 AM
Hello Liam,

 Unfortunately you are right. We've fixed this immediately and the fix will be part of our next internal build - the grid will not attempt to sort anymore if there is a pending change (changed, inserted and/or deleted item).
It seems that however for grouping and filtering we cannot do much since both CanGroup and CanFilter from ICollectionView will not be affected in this case in DomainDataSourceView and you will get the same exception with pending change and filter and/or group from the grid. At least we can improve this in our own RadDomainDataSource.

I've added 2000 Telerik points to your account!

Kind regards,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Mark
Top achievements
Rank 1
answered on 06 Jan 2011, 01:11 AM
With the fix, will there be away for the grid to be filterable/groupable/sortable with changes as per the Q2 release? 

I have added in
CanUserSortColumns="{Binding ElementName=DataSource, Path=CanLoad}"
to stop sorting with pending loads, but cannot find something comparable for grouping

Is it a matter setting e.Cancel to true in the Grouping event and then removing all the group descriptors to remove the display?
0
Accepted
Vlad
Telerik team
answered on 06 Jan 2011, 08:11 AM
Hello,

 The grid will not be able to sort if you have pending changes - exactly in the same way as in standard Silverlight DataGrid. Indeed for grouping and filtering you can set e.Cancel = true in respective events to cancel these operations.  

Best wishes,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Frank
Top achievements
Rank 2
answered on 22 Sep 2011, 03:02 PM
I am having a similar problem with grouping or filtering directly after a cell edit. Is there a way to commit pending changes after a cell edit? I am currently updating the source database  with the changed value in the CellEditEnded event.

I tried using RadGridView.CommitEdit() after my database update  but that caused an error.

Thanks,

Frank  
0
Rossen Hristov
Telerik team
answered on 23 Sep 2011, 11:35 AM
Hi Frank,

When the state is "dirty", i.e. you have something added, removed or edited, you have to call either the SubmitChanges or RejectChanges method on the DomainDataSource before you will be able to load again. 

Unfortunately, we can't tell more about your exact setup from the information that you have provided.

Regards,

Ross
the Telerik team

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

Tags
GridView
Asked by
Mark
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Mark
Top achievements
Rank 1
Frank
Top achievements
Rank 2
Rossen Hristov
Telerik team
Share this question
or