DataTable onClick Uncaught TypeError: table.row(...).data is not a function

DataTable onClick Uncaught TypeError: table.row(...).data is not a function

SilverEditionSilverEdition Posts: 1Questions: 1Answers: 0

When using ServerSide: ture and Processing: true on button click I get:
Uncaught TypeError: table.row(...).data is not a function

$("#table").DataTable({
    bProcessing: true,
    bServerSide: true,
    ajax: {
        url: "/data/users",
        type: "post"
    },
    select: true,
    columns: [
        { data: "Name", title: "Name" },
        { data: "Surname", title: "Surname" },
        { data: null, title: "Edit", "defaultContent": "<button>Edit</button>" }
    ]
});

$("#table").on('click', 'button', function() {
    var data = table.row($(this).parents('tr')).data();
});

Answers

  • allanallan Posts: 63,747Questions: 1Answers: 10,509 Site admin

    I don't see where the variable table is being assigned. Is the code above incomplete, or is that the error? Can you please link to a test case, as per the forum rules.

    Allan

This discussion has been closed.