I'm seeing some references to how to bind a click event to the rows in a datatable but I'm not clear on how it works. I see references to fnDrawCallback but I haven't had any luck getting it to work, so I would appreciate whatever help I can get.
I'm creating the table empty and then populating it from a database using JSON and that part is working fine, but I want to be able to click anywhere in a row and have that kick off another Javascript function to pull more data from the database and display that. I haven't seen any examples of that so far.
Here is the javascript I'm using to populate the table:
This is working, the table is populating, the pagin works, the search works. In fact it all looks really good. But I'm stumped on how to move to the next step.
Thanks very much.
I'm creating the table empty and then populating it from a database using JSON and that part is working fine, but I want to be able to click anywhere in a row and have that kick off another Javascript function to pull more data from the database and display that. I haven't seen any examples of that so far.
Here is the javascript I'm using to populate the table:
function fillFirmTable() { $.ajax({ url: "./FirmServlet?action=all", cache: false, dataType: "json", success: function(data) { $('#firmtable').dataTable().fnClearTable(); $.each(data, function(k,v) { var firmid = (v.firmid) ? v.firmid : '0'; var firmname = (v.firmname) ? v.firmname : 'Firm Name'; $('#firmtable').dataTable().fnAddData( [ firmid, firmname, ] ); }); } }); }
This is working, the table is populating, the pagin works, the search works. In fact it all looks really good. But I'm stumped on how to move to the next step.
Thanks very much.