jquery - Getting row data from Datatables -
i have web2py app uses datatables extensively, in simple forms. 1 of views uses server-side processing populate table, , need info row when user clicks on row of table. i've used illustration code datatables site, can't work.
here datatables intialization (datatables 1.10):
<script type="text/javascript" charset="utf-8"> var otable; $(document).ready(function() { otable = $('#parts-list').datatable({ searching: true, displaylength: 10, lengthchange: false, paging: true, processing: true, serverside: true, ajax: '/init_ss/default/get_data_server_side', "language" : { zerorecords: "the search turned no part"}, "columndefs": [ { "data": null, "targets": [ 6 ], "defaultcontent" : "click on row add together request information</a>" } ] }); }); </script> this works expected: table gets constructed properly, lastly column's content beingness words "click on row add together request information."
to process click on row in table id of "parts-list," have code:
<script> $(document).ready(function() { var table = $('#parts-list').datatable(); $('#parts-list tbody').on( 'click', 'tr', function () { console.log( table.row( ).data() ); alert("retrieved info selected row"); } ); </script> this straight datatables website, in api reference row(), data(). me, doesn't work - can't see function retrieve row info ever gets called when click in row of table.
jquery datatables
No comments:
Post a Comment