Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Master/Detail ListGrid highlighted/selected row

    I have a Master/Detail setup similar to the one in the showcase. When you select a row in the ListGrid, it is highlighted in the grid and displayed in the from below. Once I make a change in the form and click the save button, the highlighted row in the ListGrid is no longer highlighted/selected. Anyone know why it gets deselected and how to keep it selected?

    This behaviour can be seen in the Master/Detail showcase example as well.

    #2
    I'm not too sure what's going on under the surface, but you can see tricky things might happen if the user edits a primary key field, or the value of a field that the grid is currently sorted on. The grid would have to fetch the saved data, work out what happened to the record which was selected, find it, scroll to it and select it. If the primary key was changed it might be hard to reliably find it again.

    The default action of coming back with nothing selected appears to be the simple and reliable thing to do.

    On the face of it it seems simple to save the primary key of the selected grid record at the point of the save, then restore that location afterwards. However, I tried this on some of my code, and it seems that attempting to restore the selection of a grid in the save button's click handler doesn't work. I'm not sure where the best place to restore that grid selection would be.

    Comment


      #3
      Originally posted by delshole View Post
      However, I tried this on some of my code, and it seems that attempting to restore the selection of a grid in the save button's click handler doesn't work. I'm not sure where the best place to restore that grid selection would be.
      On the grid's DataArrivedHandler seems to work. :)

      Comment


        #4
        Thanks, I will try that.

        I have no issues about the primary key as we use hidden unique id that the user does not see and cannot change.

        Comment

        Working...
        X