Deslect a row in a grid

3 posts, 1 answers
  1. Dr.YSG
    Dr.YSG avatar
    210 posts
    Member since:
    Dec 2009

    Posted 07 Nov 2012 Link to this post

    I need to programmatically deselect rows in a grid. I have not seen any API method for this. select() will return all rows, and select(<obj>) will select one item.

    My issue is that I have 10 out of 50 selected, but now the user has done something and I need one of the 10 deselected (but the rest to remain selected).

    I thought I had a brainstorm and that I could use jquery to trigger a CNTRL-CLICK:

    var e = jQuery.Event("click");
    e.ctrlKey = true;
    $(this.gridRow).trigger(e);
    Where this.gridRow refers the the DOM object which is the row in the grid (i.e. <TR> )which is currently selected. I have verified in FireBug that the value of tthis.gridRow is actually the <TR> row in the kendo Grid, and that it is currently selected. (see screen shot)

    See attached screen shot which shows that firebug reporting that the this.grid is indeed a tr, and it has a click handler.
  2. Answer
    Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 12 Nov 2012 Link to this post

    Hi Yechezkal,

     

    Please note that you can deselect given row by removing it's CSS class "k-state-selected". Please check the example below:

    $(rowToDeselect).removeClass("k-state-selected");
    Kind Regards,
    Vladimir Iliev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Dr.YSG
    Dr.YSG avatar
    210 posts
    Member since:
    Dec 2009

    Posted 12 Nov 2012 Link to this post

    Works great. And solves a long standing problem I have had. Consider adding this tip to the documentation (Do you have a way of linking forum notes to the API docs?)

Back to Top