Cannot set property id of null

Cannot set property id of null

elahi1mahdielahi1mahdi Posts: 9Questions: 5Answers: 0

I set Id In add Row But Show This Error 'Cannot set property id of null'
Why?
var table1 = $('#Mytable').DataTable();
var rowNode = table1.row.add([firstrow, data.customerFullName, model.title, model.data_Contract, model.data_Delivery, model, data.project_status, lastrow])
.node().id = 'MyID';
table1.draw(false);

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @elahi1mahdi ,

    It's probably because the column count doesn't match what's expected. We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • elahi1mahdielahi1mahdi Posts: 9Questions: 5Answers: 0
    edited July 2018

    how do i write now? @colin

  • elahi1mahdielahi1mahdi Posts: 9Questions: 5Answers: 0

    How to Solve This Problem ? @colin

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    As Colin noted, please provide a link to a test case showing the issue so we can help to debug the problem.

    My guess is that you might have deferRender enabled and the node hasn't been created when you call row().node(). But without a test case it is impossible to say.

    Allan

This discussion has been closed.