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

Loosing current item when editing with active sorting

8 Answers 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sven J
Top achievements
Rank 2
Sven J asked on 16 May 2012, 01:21 PM
Hi,

there seems to be a problem within the silverlight RadGridView. If I have input on a sorted column the current item gets lost if I jump out of the grid. You can reproduce this in your demo: 
http://demos.telerik.com/silverlight/#GridView/Selectors/DataTemplateSelectors/CellEditTemplateSelector 

Just sort the column ProductName, then change a ProductName. If you now focus something else on the page (e.g. the description on the left hand side) the grid gets resorted and the current item is lost (and an other item gets active).

Please help and if possible provide a quick workaround.

Thanks
Sven

8 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 16 May 2012, 03:04 PM
Hi,

 I have checked the behaviour that you described. The same will happen if you change a ProductName and commit the edit (when you press Enter for example). When the edit is committed the column is resorted. 

Would you please let me know what scenario would you like to achieve?
 

Greetings,
Didie
the Telerik team

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

0
Sven J
Top achievements
Rank 2
answered on 16 May 2012, 03:20 PM
Hi, 

thanks, for your quick reply. My expected behavior is to simply stay on the record. 

Example, in my case I use a RadTabControl. On the first tab I have the RadGridView to show/edit main data. On the second Tab I have details. So if I change the value of the sorted column and jump to my details (click on the 2nd tab) 
the current item is not the one that I expect. In the background the RadGridView was resorted and changed the current item and now the details tab is showing me details of the wrong record...

Sven
0
Dimitrina
Telerik team
answered on 16 May 2012, 03:34 PM
Hi,

To achieve that you should set the ActionOnLostFocus property of the GridView to be "None". By default it is "CommitEdit" and that is why you experience such a behaviour.

Greetings,
Didie
the Telerik team

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

0
Sven J
Top achievements
Rank 2
answered on 21 May 2012, 10:30 AM
Hi,

And thanks again for your reply. The behavior seems working if I bind to a collection directly. Unfortunately I use a
QueryableCollectionView which seems to ignore this setting... 

Any suggestion?

Sven 
 
0
Dimitrina
Telerik team
answered on 21 May 2012, 12:30 PM
Hi,


Would you please set the "IsContentPreserved" property for the RadTabControl. By default RadTabControl unloads the content of the previous tab (unless RadTabControl.IsContentPreserved property is set to true) and this should be the reason for your issue.

Greetings,
Didie
the Telerik team

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

0
Sven J
Top achievements
Rank 2
answered on 21 May 2012, 12:40 PM
Hi,

still not working. I have an ugly workaround by subclassing the QueryableCollectionView, overriding the CommitEdit() and not firing base implementation...

Any other suggestion?

Sven
0
Dimitrina
Telerik team
answered on 21 May 2012, 02:56 PM
Hello Sven,

 So far I cannot reproduce the issue you have and I cannot suggest further.

Please find attached my test project. Would it be possible for you to change it so that I can see the problematic behaviour?

Greetings,
Didie
the Telerik team

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

0
Sven J
Top achievements
Rank 2
answered on 22 May 2012, 09:50 AM
Hi again,

took me a while to extract my solution code into your example to examine the behavior. While doing that I encountered the following situations where a commit happens unintentionally:

1. Setting GridView's ActionOnLostFocus="None" in a Style and RadTabControl's IsContentPreserved="False". Setting ActionOnLostFocus at control level, IsContentPreserved can be true or false -> no commit here.

2. Adding a Column with a CellTemplate (CheckBox) and Binding. A commit is triggered when IsContentPreserved="True" and ActionOnLostFocus="None" is set at control level. Note that in this case setting IsContentPreserved="False" stops committing!

I'm opening a support ticket to submit the solution.

Thanks
Sven
Tags
GridView
Asked by
Sven J
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Sven J
Top achievements
Rank 2
Share this question
or