Send fnGetData value as a query to database?
Send fnGetData value as a query to database?
Rawland_Hustle
Posts: 94Questions: 16Answers: 0
My DataTables gets data from my mysql database. If my table consists of car brands, and I click a certain car brand, let's say "Ford", I want DataTables to ask my database for all the different models of "Ford" and display them in another table (with another set of column headers).
I think I'm supposed to use fnGetData for this, but I don't have a clue how to send the query and show the respons in a different table.
Could someone please tell me how I should get started?
Thanks!
I think I'm supposed to use fnGetData for this, but I don't have a clue how to send the query and show the respons in a different table.
Could someone please tell me how I should get started?
Thanks!
This discussion has been closed.
Replies
[code]
$('#myTable').on( 'click', 'tbody td', function () {
var cellData = table.fnGetData( this );
createSubTable( cellData );
} );
[/code]
The real work is in `createSubTable` which you'd need to write to make a call to the server, get the data you want and show it in the subtable. That's just standard Javascript to do that.
Allan