webismymind / editablegrid

EditableGrid is an open source Javascript library aimed at turning HTML tables into advanced editable components. It focuses on simplicity: only a few lines of code are required to get your first table up and running.
http://www.editablegrid.net
Other
795 stars 272 forks source link

get row index jquery #139

Open ramonYcajal opened 7 years ago

ramonYcajal commented 7 years ago

hi!! if I type jquery in console of chrome, taking the id of tr, and passing it to getRowIndex method, runs without problem but If I do the same in script, getRowIndex always returns -1 $(document).on("keyup","tr",function(event){ if(event.which==9){ var table=this; console.log($(table).attr("id")); console.log(editableGrid.getRowIndex($(table).attr("id")));

                }
            });     
ramonYcajal commented 7 years ago

i fix this, the problem was in the passed value in the method getRowIndex, i was passing a string and it wants an object, the code fixed is like this: $(document).on("keyup","tr",function(event){ if(event.which==9){ var table=this; console.log(editableGrid.getRowIndex(table)); // or you can also pass "this", it works too. } });