When passing pure HTML, the first set of input radio elements are not rendered (checked) correctly

When passing pure HTML, the first set of input radio elements are not rendered (checked) correctly

glendersonglenderson Posts: 231Questions: 11Answers: 29

Please refer to this fiddle, https://jsfiddle.net/glenderson/r1L5nwz2/3/

I pass pure HTML to datatTables all the time. However, I've noticed that for the first data row, if the input type is a radio element, then the values are not "checked". That is, it's appearing that dataTables is not passing through the HTML checked attribute to the table correctly for the element type of input radio.

This works fine for checkboxes as shown in the 2nd table of the fiddle.

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 54,900Questions: 1Answers: 8,605 Site admin
    Answer ✓

    This is a very unfortunate side effect of how the auto width option works in DataTables. Basically it will create a cloned "worst case" table and then insert that into the document. The issue with that is you then have another radio box which has a matching name as that in your first row and is also marked to be "checked". Since only one can be, the new one "wins".

    At the moment the work around is to disable the autoWidth option (example). However, i will look into how I can resolve that correctly in the core and post back here when done.

    Allan

  • glendersonglenderson Posts: 231Questions: 11Answers: 29

    Excellent! Using the work around will do for now.

  • allanallan Posts: 54,900Questions: 1Answers: 8,605 Site admin
    Answer ✓

    This fix will be included in the 1.10.11 release that I plan to make in the next few days.

    Regards,
    Allan

  • glendersonglenderson Posts: 231Questions: 11Answers: 29

    Thanks, I've pulled it in and the issue is resolved.

This discussion has been closed.