Loosing current item when editing with active sorting

9 posts, 0 answers
  1. Sven J
    Sven J avatar
    26 posts
    Member since:
    Nov 2009

    Posted 16 May 2012 Link to this post

    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

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 16 May 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Sven J
    Sven J avatar
    26 posts
    Member since:
    Nov 2009

    Posted 16 May 2012 Link to this post

    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
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 16 May 2012 Link to this post

    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 >>

  6. Sven J
    Sven J avatar
    26 posts
    Member since:
    Nov 2009

    Posted 21 May 2012 Link to this post

    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 
     
    
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 21 May 2012 Link to this post

    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 >>

  8. Sven J
    Sven J avatar
    26 posts
    Member since:
    Nov 2009

    Posted 21 May 2012 Link to this post

    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
  9. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 21 May 2012 Link to this post

    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 >>

  10. Sven J
    Sven J avatar
    26 posts
    Member since:
    Nov 2009

    Posted 22 May 2012 Link to this post

    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
Back to Top
DevCraft banner