About jQuery function for a custom button in DataTables
About jQuery function for a custom button in DataTables

Is posible to use a jQuery for a custom function in DataTables? Something like this:
$('#nuevo_med_btn').click( function() {
var data = table.$('input').serialize();
# Validate data and post data to PosgreSQL database here
);
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi @nrtriana ,
This example here should help, it's showing how to do just that,
Cheers,
Colin
Yeah @colin, I see this example... but I have a form in each row of my table, I want to post fields of individual rows to my database table. It's possible?
Have you send Editor, that makes that much simpler?
@colin I have a list of medical drugs that is generated by a Django view and show in an HTML template where I use DataTables. I want a submit button in each row of the table that make a post action that insert new records un another table of my PostgreSQL database. The master original table (records sender table) is not altered by the button action.
By the way thank you for your help and your attention my friend.
Here are a couple examples with buttons in each row. You can modify the event to add a jQuery ajax request.
Using
defaultContent
:http://live.datatables.net/xijecupo/1/edit
Using
columns.render
:http://live.datatables.net/qemodapi/1/edit
Kevin
Kevin, my friend thank you for your help, now I need to know how to use Ajax Post with Datatables.
There is an example of ajax post in the
ajax
docs.Kevin
Thank you Kevin! Now I have to fully understand exactly how the ajax option work... you know, English it's not my native language and sometimes I have troubles trying to understand technical concepts explained in English. I hope I can do it.
My friend, take my email address nrtriana26724[at]gmail.com and my LinkeIn profile page. Feel free to talk me if you have time and you see me online I like to meet new colleages in computer science world and share with them my experiences.
Néstor.
Not only are the instructions in English but the site has lots of information and sometimes guidance is needed to find it
Kevin