Prevent detail button to select row

4 posts, 0 answers
  1. Pascal
    Pascal avatar
    10 posts
    Member since:
    Oct 2007

    Posted 07 Feb 2012 Link to this post

    I have a grid with row selection and detail for each rows, ex:

    var grid = $('#myTable').kendoGrid({
       selectable: "row",
       detailInit: function() { /* load detail items with json ajax request */ },
       change: function() {.... }
    }).data('kendoGrid');

    When I click on the button that shows the details, the change event is also triggered. Is there a way to prevent that?
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2284 posts

    Posted 09 Feb 2012 Link to this post

    Hello Pascal,

    The selection of the grid cannot be prevented. You can easily modify the beahvior as shown on the jsFiddle bellow:

    http://jsfiddle.net/rusev/HrfsV/

    All the best,
    Nikolay Rusev
    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. Basem
    Basem avatar
    27 posts
    Member since:
    Dec 2010

    Posted 21 May 2012 Link to this post

    Since I had a change event in my grid, I needed to handle this more precisely. So I ended up testing if the click actually came from the hierarchy link or was a real row select:

    function isHierarchyClick() {
      return $(event.target).parent().hasClass('k-hierarchy-cell');
    }
     
    function onGridChange(e) {
            if (!isHierarchyClick()) {
                //DO SELECT ACTIONS HERE
            }
    }

    I am testing if the triggered event came from the hierarchy link, which I am assuming is a direct child of ('.k-hierarchy-cell'). This would be a nice property off the grid called "selectOnDetail: false". I hope this helps.
  5. Jaime
    Jaime avatar
    60 posts
    Member since:
    Mar 2013

    Posted 17 Sep 2013 Link to this post

    sure but doesn't work in IE or Firefox
Back to Top
Kendo UI is VS 2017 Ready