Grabbing data from columns in tbody.

Grabbing data from columns in tbody.

nicoledramirez@hotmail.comnicoledramirez@hotmail.com Posts: 60Questions: 14Answers: 2
edited May 2017 in Editor

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 + '&nbsp;&nbsp;&nbsp;<b>Clinician Name: </b>' + ClinicianName + '&nbsp;&nbsp;&nbsp;<b>Service Date: </b>' + ServiceDate + '&nbsp;&nbsp;&nbsp;<b>Service Date: </b>'+Service+'&nbsp;&nbsp;&nbsp;<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

Answers

  • allanallan Posts: 61,663Questions: 1Answers: 10,095 Site admin
    Answer ✓

    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

  • nicoledramirez@hotmail.comnicoledramirez@hotmail.com Posts: 60Questions: 14Answers: 2

    I was able to work this out. You can close. Thank you!

This discussion has been closed.