select extension error
select extension error
I am trying to incorporate the Select extension into an existing DataTable. We desire to have the 'os' selection features that this extension provides. We might eventually incorporate Buttons too.
The page already had self-built multiple selection capabilities, but not the ability to shift-click a range of rows.
I have disabled my old selection code and have simply added a select: true when initializing the DataTable. Selection isn't working but I do see this JS error:
Uncaught TypeError: Cannot read property 'row' of undefined
at Object.<anonymous> (jquery.dataTables.select.min.js:14)
at Function.each (jquery-1.11.2.min.js:2)
at jquery.dataTables.select.min.js:14
at jquery.dataTables.select.min.js:5
at jquery.dataTables.select.min.js:5
This page's DataTable has no data when the page is displayed. It's content is provided via a search.
Unfortunately, development is on a private server so I can't easily demonstrate and the page is too complex to try to post full code examples.
Do I need to do more that starting with select: true?
Is the fact that the table is empty causing a problem? If so, do I need to enable select via the API?
What is the minimum compatible DataTables version? The page still uses 1.10.1.
Are there other things that I am possibly missing? Note that when a table has content it make contain links that can be individually clicked.
Thanks,
Brad
Answers
Further investigation reveals that I'm getting the error by simply including the the Select extension. It even results when the initialization code is not present.
I'm including DataTables before the Select extension which is before my app's main JS file where initialization occurs.
jQuery is v 1.11.2
DataTables is v 1.10.1
Select is v 1.2.1
Upgrading DataTables to the latest version got rid of the error and 'os' style selection is now enabled. Now I just need to make pre-existing code work with it.
Yeah - Select requires at least 1.10.7 I think. It should actually check for that - I'll look into that.
Allan