I need to get the row ID or the index of the selected rows from jquery datatables without using tablets. Once I If I get the index or id, then I will use these rows to select when the user will come back to the same page. How do I get the row id or index of selected rows? thanks a lot!
JSP code:
// When a line is selected, then I need to get a line id or index $ ('# usertable TBT'). ('Click', function () {var oTable = $ ('# userTable') .DataTable (); var data = oTable.fnGetData (this); selectedRowId = data [4]; Warning (selectedRowId); // Printed "undefined" var rowIndex = oTable.row (this). Index (); Alert (line index); // This alert was not implemented too.});
var rowIndex = oTable.row (this) .index ();
The above will work but you have to use it:
var oTable = $ ('# userTable'). Datatelle ();
The API will return and allow you to use the line (this). Indexes ()
Instead of:
var oTable = $ ('# userTable'). Datable ();
Although without seeing the working copy of the code (which may be JSFDial), I am unsure of why fnGetData ()
is not working
No comments:
Post a Comment