Column selector by name property not working

Column selector by name property not working

remyjetteremyjette Posts: 7Questions: 1Answers: 0
edited May 2014 in DataTables 1.10

In the documentation for 'columns.name', it says:

"This can make working with columns in the API very easy - for example to access the data from the column named location you would use table.column( 'location' ).data(). For more information about column selectors, please see the column()DT documentation."

However, this doesn't appear to work, see: http://live.datatables.net/duvehan/1/edit

Thanks for the excellent release by the way!

This question has an accepted answers - jump to answer

Answers

  • remyjetteremyjette Posts: 7Questions: 1Answers: 0

    Did some digging on this.

    __re_column_selector is '/^(.*):(name|visIdx|visible)$/'. As a result, I can add the suffix ':name' to my search string, and it does now work. If I try it as listed in the documentation, the regex doesn't match so it uses the 'else' case of treating it as a jQuery selector.

    Is this a bug with DataTables, that I should be able to just put in the string name of my column? Or is the documentation incorrect and I need the ':name' suffix?

    Thanks!

  • allanallan Posts: 61,710Questions: 1Answers: 10,103 Site admin
    Answer ✓

    Or is the documentation incorrect

    This one. Sorry about that! I did originally plan to have it as a documented in columns.name but during development of 1.10 I found that it was much more common to use jQuery selectors than the names, so I optimised that path.

    I've committed a fix here and I'll be updating the site with the change soon. Thanks for letting me know about this!

    Allan

This discussion has been closed.