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

How to define 'cancel' click with inline editable

1 Answer 880 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tyree
Top achievements
Rank 2
Tyree asked on 05 Nov 2013, 12:56 PM
I have defined editable as:
editable: {
    mode: "inline",
    update: false,
    destroy: false
},


my column as:
command: [
    {
        name: "edit",
        text: {
            edit: " ",
            update: " ",
            cancel: " "
        },
        click: clickEdit
    },
I want to tie into when the "cancel" button is clicked but I have not found a way.  Tying to the grids "cancel" event never fires . This seems odd because the "edit" and "save" events do fire as expect...just not the cancel.

Technically I need to run code every time the grid goes into edit mode, and every time the grid leaves edit mode. Is there another way besides the grid events? Why isn't the cancel event firing? Can I attach to the cancel click like the edit click? If so how.

On another note, can you prevent a row from leaving edit mode?

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 06 Nov 2013, 01:39 PM
Hello Tyree,

My suggestion is to use the build-in cancel event of the Grid. I am not sure why the event does not fire in your case because the provided code does not show how you bind to it. The event seems to fire as expected in this sample page:

In case you prefer to directly bind to the click event via jQuery, you can attach your event event handler at the edit event of the Grid. For example:
$("#grid").data("kendoGrid").bind("edit", function(e) {
    e.container.find(".k-grid-cancel").click(function(e) {
        //your code
    });
});

I hope this will help.

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
Tyree
Top achievements
Rank 2
Answers by
Alexander Valchev
Telerik team
Share this question
or