Multiple row selection without holding CTRL key?

5 posts, 0 answers
  1. Basem
    Basem avatar
    27 posts
    Member since:
    Dec 2010

    Posted 17 May 2012 Link to this post

    Can I make row selection happen with just clicks? Currently with multiple selects enabled, clicking one row at a time unselects the previous row.

    Actually I am not very clear of the behavior of multiple selects because seems a bit quirky. Sometimes it leave the class k-selected-state of the previous row and other times not.
  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 19 May 2012 Link to this post

    Hello Basem,

    Such functionality is not supported out of the box, but you could achieve it using custom code. For example:

    $("#grid").delegate('tbody>tr', 'click', function(){
      $(this).toggleClass('k-state-selected');
    });
    Please notice that in this case you need to set to the Kendo UI Grid selectable: false property. For convenience, I created a simple example, which illustrates such approach in action.

    Regards,
    Iliana Nikolova
    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. Sim
    Sim avatar
    3 posts
    Member since:
    Jul 2012

    Posted 03 Jul 2012 Link to this post

    hi iliana,

    i followed your example and indeed it work as expected. but, how can we actually get the data in the selected item/s?  i am a newbie trying to learn a wonderful tool.  can you help me out?

    this is my listView template..
    <script type="text/x-kendo-tmpl" id="template">
        <div class="addons drpBlackShd">
            <g:hiddenField name="id" value="69"/>
            <img src='http://localhost:8080/??????Air/addOn/getImage/#=id#' alt="#=name# image"/>
            <h3>#=description#</h3>
            <dl>
                <dt>Price:</dt>
                <dd>#=kendo.toString(basePrice, "c")#</dd>
            </dl>
        </div>
    </script>

    there is a total price on my page and i would like to add the basePrice there when selected and subtract also when deselected.
    i would also like to capture the id as params to the next page.  how can i achieve all this in grails? 

    thank you in advance.
  5. Jesper
    Jesper avatar
    25 posts
    Member since:
    Jun 2012

    Posted 04 Jul 2012 Link to this post

    This is the Grid forum, so I'm going to presume that you're talking about a grid, event though you mention a listView.

    You can get selected rows in your grid using the myGrid.select()-method. This will return an array of rows. You can get IDs by iterating over the rows.

    To get the model behind the row, you can use the dataItem()-method, using the corresponding row as argument.
  6. Mark
    Mark avatar
    7 posts
    Member since:
    Dec 2012

    Posted 10 Apr 2014 in reply to Jesper Link to this post

    myGrid.select() won't work with the grid's selectable feature disabled (which is what Iliana's solution involves).  You would need to iterate through the grid and find all <tr> elements with a "k-state-selected" class. 
Back to Top
Kendo UI is VS 2017 Ready