Question about adding cell text with createdRow

Question about adding cell text with createdRow

chillychilly Posts: 7Questions: 4Answers: 0

Hello,

I'm trying to insert in a custom link into a row with datatables using the 'createdRow' option.
I'm hitting an odd error where sometimes I encounter this error: Uncaught TypeError: Cannot read property 'html' of null
This hits on the createdRow line of my Javascript.

When I reload the page a few times, the error seems to disappear and the page generates as expected. Is there any way to work around this issue?

Answers

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin

    Can you link to a page showing the problem so we can try to debug it please? I'm not aware of any issues with createdRow at the moment.

    Allan

  • chillychilly Posts: 7Questions: 4Answers: 0

    I'm not sure if I'm allowed to, since it's an internal company page. Would posting some of the Datatables setup code help?

  • chillychilly Posts: 7Questions: 4Answers: 0

    Oh, I figured out what the issue was. When you want to set the row's cell content ( $('td',row).eq(5).html(.....)), the '$' operator was being overwritten by out content management system (Joomla). I just had to declare the method as jQuery('td':row).eq(0).

    Sorry about the confusion!

  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin

    Cool. Good to hear you got it sorted.

    Allan

This discussion has been closed.