SelectedItem/CurrentItem

5 posts, 0 answers
  1. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 19 Jun 2013 Link to this post

    Hi Telerik Team,

    I think I've asked this question in the past, and when I think I understand it, something happens and then I don't.  Here is what I'm thinking

    CurrentItem = The Current Item in the grid (and there can only be on), that is not necessarily selected (i.e. clicked on by the mouse)
    SelectedItem(s) = Any Items that have been clicked by the mouse.

    I'm trying to Select a row (as if it were clicked by a mouse) but that doesn't seem to work.

    I've done the following:
                _radGridView.CurrentItem = item;
                _radGridView.SelectedItem = item;
    and
                _radGridView.SelectedItem = item;
                _radGridView.CurrentItem = item;

    Unfortunately, I can't seem to get the item to be "Selected".  I have checked that the CurrentItem and SelectedItem are indeed that same object.  The SelectedItems Collection has only one object, and it is the SelectedItem object.  However, the selected item is not selected/highlighted.  I still have to click it with the mouse.

    Also, after setting these properties, I'm calling:
    _radGridView.ScrollIntoView(_radGridView.CurrentItem);

    The ScrollIntoView() only works periodically and doesn't work more than it does.

    Here is what I would like to accomplish.  I have a grid with items in it.  The user wants to add a record, (via another dialog, not adding a row directly to the grid perse).  I take the record they have added from the dialog and add it to the grid's Items collection and the collection is sorted.  The grid should then actually select (as if clicked) the row that was added, and make sure it's visible to the user.  How do I accomplish this?

    Thanks for your help!!

  2. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 20 Jun 2013 Link to this post

    Is there any solution to this?  I really need to be able to select a record in a grid, and I need to be able to make the grid visible to the user without them having to scroll up or down to find it.

    ????

    Thanks
  3. DevCraft banner
  4. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 24 Jun 2013 Link to this post

    Hi,

     Here is an article that illustrates the difference between selected and current item. When you programmatically update the selection, the respected item gets selected, but the unfocussed visual state is displayed. You can change this by setting EnableLostFocusSelectedState to false. As for the scrolling problem, you should be using ScrollIntoViewAsync, which is designed to work in scenarios, where the UI virtualization is switched on. 

    Regards,
    Ivan Ivanov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. WILLIAM
    WILLIAM avatar
    134 posts
    Member since:
    Jun 2012

    Posted 23 Sep 2013 Link to this post

    Thanks for your reply Ivan,

    I have read over this article and I understand setting the current item and clicking on rows adds them to the SelectedItems list.  The problem that I am having and trying to solve is the visual state of the row.  Somewhere sometime when the current item gets set (but not necessarily selected), the row indicator shows the row, and all of the cells in the row are surrounded by one big box.  It's not highlighted, there is not different background color, nothing.

    I am still having trouble with getting the grid to display this state (whatever it is).  When I set the CurrentItem, the row indicator does show on the correct row, however the row may or may not be surrounded by this box or a single cell may or may not be surrounded by a box.  It is very confusing to me and to my users.

    What does the clear box around the row signify?  Is this the visual state of GridView.CurrentItem or is the row indicator the only visual clue for the current item?

    Forget about clicking a row or making it selected.  Here is what I want to accomplish:
    1.  I want to set programmatically GridView.CurrentItem = X
    2.  I want the entire row to be surrounded by this clear box.
  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 26 Sep 2013 Link to this post

    Hi,

    I have tested selecting items on our online demos. Unfortunately I were not able to get "all of the cells in the row" to be surrounded by one big box.
    Would you please be more specific and send us an image illustrating how this clear big box looks like? How exactly do you get it?

    Regards,
    Didie
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
DevCraft banner