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

How to stop popup a custom window?I use " e.preventDefault();" on edit event but it does not work

1 Answer 730 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yin
Top achievements
Rank 1
Yin asked on 12 Aug 2013, 05:18 AM
How to stop popup a custom window?I use " e.preventDefault();" on edit event but it does not work,the edit window still popup.
Like this  sample,   I click the "Edit" button,  and popup the edit window.But sometimes I click the "Edit" button, but do not want to popup the custom window,I  want to alert("Can not edit"). I just want to popup the edit window when the Product Name is  "Chang" or  hide the "Edit" button when ProductName is not "Chang"

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 12 Aug 2013, 12:18 PM
Hi Yin,

The editor window is already opened at the edit event. In order to prevent the popup dialog to open, you should bind to the click event of the edit button and call the stopPropagation method.

$("#grid .k-grid-content").bind("click", ".k-grid-edit", function(e) {
    e.stopPropagation(); //stop the window to open
});

The code should be executed after initialization of the widget.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Yin
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or