Get selected row data with EDITOR
Get selected row data with EDITOR
Hello,
I'm new to datatables, and i'm having a real hard time getting rows infos, to use like a shopping cart.
i tried implementing this : http://jqueryui.com/droppable/#shopping-cart with no success, being able to move only #example tbody but not #example tbody tr
Then i tried to pop up a dialog with the ROW data on click, as well no success as :
[code]
oTable = $('#example').dataTable();
oTable.$('tr').click( function () {
var data = oTable.fnGetData( this );
alert( 'The cell clicked on had the value of '+data );
} );
[/code]
So how can i save the rows clicked/dragged/checked i don't care as long as it works as in a shopping cart to reuse after (generating a pdf with the shopping cart selected rows).
This is my last problem with this project, thanks in advance for your help :).
Edit: to get a better idea of what i'm trying to do check here http://codebin.org/view/4e666c97
Now i managed to get the selected row id, but i can't manage to return the name or anything..
[code]
"fnRowSelected": function ( nodes ) {
alert( 'The row with ID '+nodes[0].id+' was selected' );
oTable = $('#example').dataTable();
var data = oTable.fnGetData( nodes[0] );
alert( 'The row with ID '+data+' was selected' );
},
[/code]
I'm new to datatables, and i'm having a real hard time getting rows infos, to use like a shopping cart.
i tried implementing this : http://jqueryui.com/droppable/#shopping-cart with no success, being able to move only #example tbody but not #example tbody tr
Then i tried to pop up a dialog with the ROW data on click, as well no success as :
[code]
oTable = $('#example').dataTable();
oTable.$('tr').click( function () {
var data = oTable.fnGetData( this );
alert( 'The cell clicked on had the value of '+data );
} );
[/code]
So how can i save the rows clicked/dragged/checked i don't care as long as it works as in a shopping cart to reuse after (generating a pdf with the shopping cart selected rows).
This is my last problem with this project, thanks in advance for your help :).
Edit: to get a better idea of what i'm trying to do check here http://codebin.org/view/4e666c97
Now i managed to get the selected row id, but i can't manage to return the name or anything..
[code]
"fnRowSelected": function ( nodes ) {
alert( 'The row with ID '+nodes[0].id+' was selected' );
oTable = $('#example').dataTable();
var data = oTable.fnGetData( nodes[0] );
alert( 'The row with ID '+data+' was selected' );
},
[/code]
This discussion has been closed.
Replies
Allan