Grabbing data from columns in tbody.
Grabbing data from columns in tbody.
nicoledramirez@hotmail.com
Posts: 60Questions: 14Answers: 2
Hi!
I need to move my button from rows contained in the example table body to a grouping row called groupName. How do I grab the data from a column called cdi_master.id (column 5) in the child rows? I have tried changing $(this).child and a few other things and the field just comes up undefined.
$('#example').on('click', 'a.editor_create', function (e) {
e.preventDefault();
var data = table.row($(this).parents('tr')).data();
cdi_master_id = data.cdi_master.id;
editor.create({
title: '<b>Mileage Form</b> <font-size:x-smaller> Add your mileage information. When you have finished, click on the Update button to submit your changes.</font> <font color=red><b>*</b> = required field</font>',
message: '<b>Client Name:</b> ' + ClientName + ' <b>Clinician Name: </b>' + ClinicianName + ' <b>Service Date: </b>' + ServiceDate + ' <b>Service Date: </b>'+Service+' <b>Procedure: </b>'+Procedure+'.',
buttons: 'Update'
});
// editor.field('cdi_mileage.cdi_master_id').set(cdi_master_id)
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Can you give me a link to the page in question please? I don't know exactly where the
a.editor_create
button is, so I'm not sure if using$(this).parents('tr')
is the correct thing to do or not. I'd also need to know the full Editor and DataTables configuration so I could get the field / column names correct.Thanks,
Allan
I was able to work this out. You can close. Thank you!