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

disabled custom command button click event still firing in chrome

2 Answers 889 Views
Grid
This is a migrated thread and some comments may be shown as answers.
steve
Top achievements
Rank 1
steve asked on 24 Mar 2015, 05:51 PM
I have a kendo gird with a custom button that if disable should not allow the user to fire the click event.  This works as expected in IE but in chrome the event still fires even though the button is disabled.

I disable the button like this


    function onDatabound(e) {
        var grid = this;
        grid.tbody.find("tr").each(function () {
            var model = grid.dataItem(this);
            if (model.DraftIndicator) {
                var customButton = $(this).find(".k-grid-Download");
                customButton.attr('disabled', '');
            }
        });

I even specifically ignore the logic on the onClick event method if the button is disabled.

 function download(e) {
        e.preventDefault();
        var downloadButton = e.target;
        if (!downloadButton.disabled) {
            var tr = $(downloadButton).closest("tr");
            var data = this.dataItem(tr);
            var url = '@Url.Action("DetailsPopup", "Home")?Id=' + data.id;
            window.open(url, null, "height=600,width=1200px,status=yes,toolbar=no,menubar=no,location=no,scroll=yes");
        }
    }

 is there something special i have to do for Chrome to prevent the click event

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 25 Mar 2015, 09:37 AM
Hello Steve,

You should check for the attribute's value, similar to the following:

var downloadButton = $(e.target);         
if (downloadButton.attr("disabled") != "disabled") {
    //....
}



Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
steve
Top achievements
Rank 1
answered on 25 Mar 2015, 01:31 PM
Thanks Rosen
Tags
Grid
Asked by
steve
Top achievements
Rank 1
Answers by
Rosen
Telerik team
steve
Top achievements
Rank 1
Share this question
or