This is a migrated thread and some comments may be shown as answers.

Row select + command buttons

3 Answers 184 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marek
Top achievements
Rank 1
Marek asked on 07 Mar 2013, 02:45 PM
I use row select:
http://demos.kendoui.com/web/grid/selection.html to display Window with row details

together with:
http://demos.kendoui.com/web/grid/custom-command.html to add some actions.

And when you click the command buttons, the row select action is called at first place. How do I disable row action on command column?

Thank you for reply.

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 11 Mar 2013, 01:46 PM
Hello Marek,

This is not supported. The selection is triggered when clicking anywhere in the row. In order to prevent the selection I can suggest to bind a custom mousedown handler instead of the built-in click handler and stop the event e.g.

columns.Command(command => command.Custom("ViewDetails"));
$(function () {
        var grid = $("#grid").data("kendoGrid");
 
        grid.table.on("mousedown", ".k-grid-custom", $.proxy(showDetails, grid));
    });
 
function showDetails(e) {
    e.stopPropagation();
    e.preventDefault();
    var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
    ....
}
Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Telerik team
answered on 11 Mar 2013, 02:10 PM
Hello,

Sorry, there is a mistake in the selector. The class is generated in the format "k-grid-" plus command name so the selector in this case should be ".k-grid-ViewDetails".

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 19 Jul 2018, 09:58 PM

quick cheat for anyone that needs to do this..

create a bool placeholder outside of functions and set this to true at the end of Command Button event function. then in the RowSelected (or Change event), check this boolean for true and exit.  don't forget to set back to false.

if (myCommandButtonPressed) {
            myCommandButtonPressed = false;
            return;
        }

Tags
Grid
Asked by
Marek
Top achievements
Rank 1
Answers by
Daniel
Telerik team
David
Top achievements
Rank 1
Share this question
or