GridViewRow single click event

9 posts, 1 answers
  1. Pawel
    Pawel avatar
    4 posts
    Member since:
    Jul 2010

    Posted 09 Jul 2010 Link to this post

    Hi,
    I'm trying to implement expand/collapse of row details after row is clicked, however I cannot find a way to handle row 'single click' event (left mouse button down or left mouse button up). RowDetailsVisibilityMode="VisibleWhenSelected" is not satisfactory because it allows to display details of only one row at a time. SelectionChanged event also will not do, because it does not fire when the selected row is clicked again.
    Is there a way to handle simple row click event ?

    regards
    Pawel
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 09 Jul 2010 Link to this post

    Hello Pawel,

     If you want multiple row-details opened why not use GridViewToggleRowDetailsColumn instead?

    Regards,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Pawel
    Pawel avatar
    4 posts
    Member since:
    Jul 2010

    Posted 09 Jul 2010 Link to this post

    Because of user experience. I think it is much easier to expand / collapse after clicking the whole row than by clicking only one, specific column.

    regards
    Pawel
  5. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 09 Jul 2010 Link to this post

    Hi Pawel,

    You could also try to set SelectionMode to Extended, which will allow you to select multiple items and ultimately multiple row details in opened state. 


    Sincerely yours,
    Milan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Pawel
    Pawel avatar
    4 posts
    Member since:
    Jul 2010

    Posted 09 Jul 2010 Link to this post

    Setting SelectionMode to Multiple and RowDetailsVisibilityMode to VisibleWhenSelected gave the result that I expected.
    There is only a minor issue - when the column is not read only (IsReadOnly="False) ,after double clicking it, the textbox appears, I click the next column of the same row so the textbox disappears - the details remain expanded regardless of how many times I click columns of this row. To collapse the details of this row I have to click some other row, and then click the previous row.

    regards
    Pawel
  7. Answer
    Milan
    Admin
    Milan avatar
    1989 posts

    Posted 12 Jul 2010 Link to this post

    Hi Pawel,

    Then you might consider using the Multiple SelectionMode? In this mode a row can be selected/deselected with the mouse only - clicking on a previously selected row will unselect the row. Is that the functionality that you are looking for?


    Greetings,
    Milan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Pawel
    Pawel avatar
    4 posts
    Member since:
    Jul 2010

    Posted 12 Jul 2010 Link to this post

    Yes, thank you.

    regards
    Pawel
  9. Rodney
    Rodney avatar
    11 posts
    Member since:
    Oct 2010

    Posted 21 Dec 2010 Link to this post

    I have a similar issue. I have a GridView with a RowTemplate that shows some information about that row. When you click on the row it opens up a detailed view using the ItemID.

    I currently use the SelectionChanged event to open the detail page (I use the RowToggleExpander Telerik column to show and hide the row template). I can open the item detail view with the selected ItemID when I click on a row, but when I come back to the grid I can't click on the selected row again to open it (becuase SelectionChanged does not fire).

    Is there a simple way to capture the RowClicked event and pass in an ID for that row?

    Thanks
  10. Rodney
    Rodney avatar
    11 posts
    Member since:
    Oct 2010

    Posted 21 Dec 2010 Link to this post

    I came up with a hacky fix for this so that I can still use the SelectionChanged Event to get one click handling on grid rows - on the Navigated to event I set the SelectedItem to null if it is selected. This means if you click on the same row that was selected it fires again.

    It's not very nice but better than attaching a mousedown event to every single row I think - can anyone suggest a better way please?
Back to Top
DevCraft banner