0

enter image description hereIn my Kendo grid I want to find the row number where i am making selection in dropdown. So that I cauld change the datepicker editable and focused.

Attaching pic for reference.

enter image description here

This is the code for kendo field

  {
                          field: "md_of_iss",
                          title: "Mode of issue",
                          template: "#= modeName(md_of_iss) #",
                          editor: function (container) {              
                       var input = $('<input id="md_of_iss" name="md_of_iss">');
                              input.appendTo(container);
                              input.kendoDropDownList({
                                  dataTextField: "rsrc_Description",
                                  dataValueField: "md_of_iss",
                                  dataSource: array,
                                  change: function (e) {

                                  }

                              }).appendTo(container);
                          },

                      },
Rajdeep
  • 788
  • 7
  • 26

1 Answers1

1

Try this:

change: function (e) {
    var rowIndex = $(this).closest("tr").index();
}.bind(input)

Working demo

Just bind the input to the change event context to use it to find the current tr index with index().

DontVoteMeDown
  • 21,122
  • 10
  • 69
  • 105
  • its giving -1. actually $(input).closest("tr") is not available. – Rajdeep Jul 12 '16 at 12:08
  • your demo works fine, but in my project the $(this).parent().length = 0, It seems to be some independent body. So i cant find the row index – Rajdeep Jul 13 '16 at 10:26
  • @Spark There is no `$(this).parent().length` in my code or in yours either. I don't know why it isn't working. – DontVoteMeDown Jul 13 '16 at 11:30
  • can you tell me a way how can i debug the jsfiddle . I could not get the js file that is doing the job – Rajdeep Jul 14 '16 at 09:13
  • @Spark sure, just add a [`debugger`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger) statement anywhere in your code with your developer tools open. [Here's how to use it](http://stackoverflow.com/a/988624/1267304). – DontVoteMeDown Jul 14 '16 at 11:40
  • I want to debug the jsFiddle u gave me. I am not getting a way to debug that – Rajdeep Jul 15 '16 at 12:23
  • @Spark dojo.telerik seems to be unstable for me, I can't save a new version, but you can just add `debugger;` after this line `change: function (e) {`. Then you open your dev tools (F12) and hit *Run*. It should stop in your debugger. – DontVoteMeDown Jul 15 '16 at 12:38