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

How to fire programatically edit event?

4 Answers 1086 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Irving
Top achievements
Rank 1
Irving asked on 26 Jul 2016, 03:52 AM

I have a grid, I want to fire the event edit like I'm clicking the edit button to fire the popup edit template, but without clicking it with the mouse but programatically. I this posible?

I tried trigger it on the databound event like this:

 

for (var i = 0; i < rows.length; i++) {

if(Myid == theIdOntheRow)

{

 $(rows[i]).addClass('k-state-selected');
                        var btnEdit = $(rows[i]).find(".k-grid-edit");                        
                        btnEdit.trigger('click');

 

...

 

I hope there are a clenear way to do this. Thanks

4 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 26 Jul 2016, 08:45 AM

Hello Irving,

You could use the editRow method of the Grid API instead. It receives the DOM element of the row as a parameter.

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-editRow

Regards,
Dimiter Madjarov
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Irving
Top achievements
Rank 1
answered on 26 Jul 2016, 01:23 PM

Thanks for you quick respose. This works really good. The problem I'm having is about when to fire this event. I have a Kendo MVC grid, if I call this on the Databound event it's loops causing a maximum stack size. If I call it in other moment I still don't have data.

 

Thanks

0
Irving
Top achievements
Rank 1
answered on 26 Jul 2016, 02:17 PM
I found that I can call this on the RequestEnd event instant of the databound event. Thanks
0
Dimiter Madjarov
Telerik team
answered on 27 Jul 2016, 11:16 AM

Hello Irving,

Thank you for updating us.

Regards,
Dimiter Madjarov
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Irving
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Irving
Top achievements
Rank 1
Share this question
or