{string}:name, with colon(s) in {string}?

{string}:name, with colon(s) in {string}?

steinbohrersteinbohrer Posts: 1Questions: 1Answers: 0

Hi,

I am using Datatables 1.10.19 and I have some troubles with column names containing a colon character (":").
It is using "getActiveTable().column(name + ':name')"; but if "name" already contains a ":" it throws an exception.

Reading the documentation (https://datatables.net/reference/type/column-selector, {string}:name) gives me no hint on what to do if the column name already contains a colon character.

The column names are generated from customer tables, so I have no influence on how they are spelled.

I have tried to prefix any ":" with one or more "\" characters, but to no avail.

Any hint?

Thanks,
steinbohrer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @steinbohrer ,

    I suspect that colons are reserved characters so I'm not surprised you'd see problems when using them. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. 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

  • kthorngrenkthorngren Posts: 20,267Questions: 26Answers: 4,764

    Likely you are getting this error:

    jquery-1.11.3.min.js:2 Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: pos

    As shown in this example:
    http://live.datatables.net/katazuru/1/edit

    Escaping with \\ or jQuery.escapeSelector() causes other errors. Although a bit of a pain my suggestion would be to create a function the replaces : with something else and call it when creating the columns.name and anytime you want to use the {string}:name selector.

    Kevin

This discussion has been closed.