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

Doubleclick and navigate to another view

7 Answers 376 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 09 Jun 2014, 06:18 AM
We are using the paid version with the razor engine.

I am looking for an example of being able to doubleclick a gridrow, get the ID from a nonvisible column and pass that value to the controller.

Might I suggest that you add filtering (paid version/razor/html) to the forum. For beginners in MVC it is difficult to locate a relevane example/response.

7 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 09 Jun 2014, 03:37 PM
Hello Mark,


To achieve this you could bind to the dblclick event of the Grid rows, retrieve the associated model with the dataItem method of the Grid API and pass it to the controller.
E.g.
$("#grid tbody").on("dblclick", "tr[role='row']", function (e) {
    var grid = $("#grid").data("kendoGrid");
    var model = grid.dataItem(this);
 
    //invoke controller
});

I hope this information helps.

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mark
Top achievements
Rank 1
answered on 13 Jun 2014, 03:09 AM
Thanks Dimiter - that worked when using Ajax as the datasource for the grid. I had to change to Server datasource (json circular reference from EF killed json) and the row does not have the [role='row'] and therefore does not fire.

Removing the role attribute allows the event to bind/fire correctly but I get the error TypeError: Cannot read property '1' of undefined   1 being the ID value of the dataitem. How do I add the roel attribute or deal with the type error.
0
Mark
Top achievements
Rank 1
answered on 13 Jun 2014, 03:27 AM
Correction 1 is the index of the selected row
0
Dimiter Madjarov
Telerik team
answered on 13 Jun 2014, 08:10 AM
Hi Mark,

When server bound dataSource is used, there is no dataItem associated to the items, since no data is stored on the client side. 

Regarding the serialization error, you could take a look at the following page, which demonstrates the possible resolutions.

Regards,
Dimiter Madjarov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mark
Top achievements
Rank 1
answered on 13 Jun 2014, 08:27 AM
Thanks
With the help of a collegue I resolved this, the circular reference was caused by EF navigation items, removing them allowed me to use the Ajax datasource and the data item appeared.
0
ajith
Top achievements
Rank 1
answered on 23 Apr 2015, 07:33 AM

Hi Dimiter,

 I want Popup a Grid View when doubleclick on a textbox. can u help me?

 

0
Dimiter Madjarov
Telerik team
answered on 23 Apr 2015, 07:42 AM

Hello Ajith,

What is the exact issue that you are experiencing? Have you tried the previously suggested approach?

Please elaborate further.

Regards,
Dimiter Madjarov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Mark
Top achievements
Rank 1
ajith
Top achievements
Rank 1
Share this question
or