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

Get Row number from Select Event Arguments

1 Answer 215 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anil
Top achievements
Rank 1
Anil asked on 19 Jun 2013, 06:26 PM
Is there a way to get the row number for the row on which the select button was clicked, i think we should be able to get it from event arguments. I tried looking through the object inspector in visual studio for the javascript event object "e" for the row number but was unable to find it. We are currently using kendo UI, asp.net mvc 4.0 and kendo MVVM. Please advise, the vent is getting fired but i cannot get the row number

//column definition for button
{ "command":{"text" : "Details",  "name":"selectClicked", click:inactiveDistrictVM.selectClicked } },

//the event delaraion
editDistricts: function (e) {
            debugger;
            var elem = this.get("districtsSource").at(0);//we need to replace the 0 with row number 
}

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 21 Jun 2013, 01:06 PM
Hi Anil,

From the provided information it's not clear for us what exactly you are meaning with the "row number", however you can check the example below of getting both the current "tr" element and the current dataItem from clicked command button:

e.g.:

editDistricts: function (e) {
            var row = $(this).closest("tr");
            //if needed you can additionaly get the current row dataItem
 
            //var grid = $(this).closest("[data-role=grid]").data("kendoGrid");
            //var dataItem = grid.dataItem(row);
 
            debugger;
            var elem = this.get("districtsSource").at(0);//we need to replace the 0 with row number
}

Kind Regards,
Vladimir Iliev
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
Anil
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or