Apply Datatable to a Dynamically created Table

Apply Datatable to a Dynamically created Table

tockztockz Posts: 2Questions: 1Answers: 0

Hi,

I'm trying to apply DataTables to dynamically created tables.

The id's of the tables all end in .costTable,

for example

SolutionOptionViewModels[347b49b5-0ea4-4404-aebe-8197bfdfced0].costTable

I've tried the following code

$(document).ready(function () {

    $("[id$='.costTable']").each(function (i, el) {

        $(el.id).DataTable();

    });
});

However it doesn't seem to work and I don't appear to get any errors.

Any help would be great.

Thanks

Answers

  • tockztockz Posts: 2Questions: 1Answers: 0

    Nevermind,

    I just had to change it to

    $(el).DataTable();

This discussion has been closed.