javascript - How do I get the id for a <tr> in when using jQuery DataTables? -


i adding button "approve" rows in table (call url process record). generate table attach datatable prefilled table. on each tr have id number of record.

<tr id="11309742">     <td>blah</td>     <td>blah</td>     <td>blah</td> </tr> <tr id="11309743">     <td>blah</td>     <td>blah</td>     <td>blah</td> </tr> 

here have far:

            $.each(table.fngetdata(), function (i, row) {                 var id = $(this).attr("id");                 $.get(myurl, { id: id },                     function (json) {                         if (json.sucess) {                             // todo remove page                         }                     }, "json");             }); 

var id = $(this).attr("id"); worked before switched datatable plugin (and know won't work now). have seen either setting id or getting index click in row. how id attribute in loop?

instead of using .fngetdata(), should have used .fngetnodes().

            $.each(table.fngetnodes(), function (i, row) {                 var id = $(this).attr("id");                 $.get(myurl, { id: id },                     function (json) {                         if (json.sucess) {                             //table.fndeleterow(i);                         }                     }, "json");             }); 

now works expected.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -