Requested unknown parameter for row 0, column 5 when using dot in column name

Requested unknown parameter for row 0, column 5 when using dot in column name

MadBoyEvoMadBoyEvo Posts: 119Questions: 38Answers: 0

Link to test case:

I have column name which contains Dot. What's the proper way to escape it?

When I remove dot from UseAHardwareSecurityDeviceTPM1.2 in two places it starts to work properly.

"data": [{
                                        "DisplayName": "ALL | Allow use of biometrics",
                                        "DomainName": "ad.evotec.xyz",
                                        "GUID": "10f0e76e-d9b5-4fa4-91a4-c2f7830827aa",
                                        "GpoType": "Computer",
                                        "UseAHardwareSecurityDevice": "Enabled",
                                        "UseAHardwareSecurityDeviceTPM1.2": "Disabled",
                                        "UseBiometrics": "Enabled",
                                        "UseWindowsHelloForBusiness": "Enabled",
                                        "UseWindowsHelloForBusinessDoNotStartWindowsHelloProvisioningAfterSignIn": "Disabled",
                                        "Filters": "",
                                        "Linked": true,
                                        "LinksCount": 1,
                                        "Links": "ad.evotec.xyz"
                                    }],
                                    "columns": [
                                        {
                                            "data": "DisplayName"
                                        },
                                        {
                                            "data": "DomainName"
                                        },
                                        {
                                            "data": "GUID"
                                        },
                                        {
                                            "data": "GpoType"
                                        },
                                        {
                                            "data": "UseAHardwareSecurityDevice"
                                        },
                                        {
                                            "data": "UseAHardwareSecurityDeviceTPM1.2"
                                        },
                                        {
                                            "data": "UseBiometrics"
                                        },
                                        {
                                            "data": "UseWindowsHelloForBusiness"
                                        },
                                        {
                                            "data": "UseWindowsHelloForBusinessDoNotStartWindowsHelloProvisioningAfterSignIn"
                                        },
                                        {
                                            "data": "Filters"
                                        },
                                        {
                                            "data": "Linked"
                                        },
                                        {
                                            "data": "LinksCount"
                                        },
                                        {
                                            "data": "Links"
                                        }
                                    ],

I don't have to touch HTML at all of course.

<table width="100%" id="DT-cHqQIDxk" class="display compact">
                            <thead>
                                <tr>
                                    <th>DisplayName</th>
                                    <th>DomainName</th>
                                    <th>GUID</th>
                                    <th>GpoType</th>
                                    <th>UseAHardwareSecurityDevice</th>
                                    <th>UseAHardwareSecurityDeviceTPM1.2</th>
                                    <th>UseBiometrics</th>
                                    <th>UseWindowsHelloForBusiness</th>
                                    <th>UseWindowsHelloForBusinessDoNotStartWindowsHelloProvisioningAfterSignIn</th>
                                    <th>Filters</th>
                                    <th>Linked</th>
                                    <th>LinksCount</th>
                                    <th>Links</th>
                                </tr>
                            </thead>
                            <tfoot>
                                <tr>
                                    <th>DisplayName</th>
                                    <th>DomainName</th>
                                    <th>GUID</th>
                                    <th>GpoType</th>
                                    <th>UseAHardwareSecurityDevice</th>
                                    <th>UseAHardwareSecurityDeviceTPM1.2</th>
                                    <th>UseBiometrics</th>
                                    <th>UseWindowsHelloForBusiness</th>
                                    <th>UseWindowsHelloForBusinessDoNotStartWindowsHelloProvisioningAfterSignIn</th>
                                    <th>Filters</th>
                                    <th>Linked</th>
                                    <th>LinksCount</th>
                                    <th>Links</th>
                                </tr>
                            </tfoot>
                        </table>**

Should I just remove the dots in JS and leave them in HTML? But I guess it will have an impact when doing a search of data via code / and conditional formatting.

What's the proper way to escape it?

Error messages shown:

DataTables warning: table id=DT-cHqQIDxk - Requested unknown parameter 'UseAHardwareSecurityDeviceTPM1.2' for row 0, column 5. For more information about this error, please see http://datatables.net/tn/4

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923

    The columns.data docs explain how to escape the ..

    . - 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

  • MadBoyEvoMadBoyEvo Posts: 119Questions: 38Answers: 0

    I tried before asking with one \ and two \ -> https://jsfiddle.net/MadBoy/sjrcd1kp/1/

    But maybe I'm missing something even more obvious?

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923
    Answer ✓

    You don't need to escape it in your data, "UseAHardwareSecurityDeviceTPM1\.2": "Disabled",, instead leave it as "UseAHardwareSecurityDeviceTPM1.2": "Disabled",. You only need to escape it in columns.data like this ``"data": "UseAHardwareSecurityDeviceTPM1\.2"`. Here is the updated example:
    https://jsfiddle.net/e06hvc19/

    Kevin

This discussion has been closed.