Data with a `.` in the name makes table creation fail.

Data with a `.` in the name makes table creation fail.

bbkanebbkane Posts: 2Questions: 1Answers: 0

Link to test case: https://jsfiddle.net/rqekxn8g/
Debugger code (debug.datatables.net): https://debug.datatables.net/ebehar
Error messages shown: DataTables warning: table id=divID_table - Requested unknown parameter 'Trans. Amount' for row 0, column 4. For more information about this error, please see http://datatables.net/tn/4
Description of problem: Data with a . in it creates an the error. Removing the . makes table creation successful

Answers

  • bbkanebbkane Posts: 2Questions: 1Answers: 0

    Not a huge deal :) (I can simply strip the . from the data field name), but this library is really helping me write my little personal budget report, so I thought I'd report the error

  • kthorngrenkthorngren Posts: 20,139Questions: 26Answers: 4,735
    edited July 2021

    You need to escape the period with two backslashes. For more details see the string section of the columns.data docs. specifically:

    . - Dotted Javascript notation. Just as you use a . in Javascript to read from nested objects, so to can the options specified in data. For example: browser.version or browser.name. If your object parameter name contains a period, use \\ to escape it - i.e. first\\.name.

    Kevin

Sign In or Register to comment.