Get selected row data with EDITOR

Get selected row data with EDITOR

sala2001sala2001 Posts: 1Questions: 0Answers: 0
edited January 2013 in 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]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    With draggable rows in DataTables, you obviously must disable sorting if you haven't already. Sorting would reposition any rows that you have dragged, so the dragging would be useless. Can't say if you have or haven't done that without more information though!

    Allan
This discussion has been closed.