jeudi 16 mars 2017

Get sibling td values based on all checked checkboxes in a datatable?

$('#board_assignee_table_wrapper input[type="checkbox"]:checked').each(function(i, td_e)
{
    console.log('Found checked checkbox');
    var assignee_id = 0;
    var team_id = 0;
    var assignee_holder = [];

    assignee_id = $(this).closest('td').next().attr('id');
    assignee_name = $(this).closest('td').next().html();
    team_id = $(this).closest('td').next().next().attr('id');

    console.log('Assignee name: ' + assignee_name);
    console.log('Team id: ' + team_id);
    console.log('Assignee id: ' + assignee_id);

    assignee_holder.push(assignee_id, assignee_name);
    board_assignees.push(assignee_holder);
});

This code only gets the values of the sibling <td> (Assignee name, team id, assignee id) of the checked checkbox on the page selected. It doesn't pick up the checked checkboxes in the other pages of the DataTable.

Here's a sample snippet of the table structure: http://ift.tt/2m7Tvzj




Aucun commentaire:

Enregistrer un commentaire