React/Datatables.net - Cannot extend unknown button type: selected
React/Datatables.net - Cannot extend unknown button type: selected

Link to test case: https://codesandbox.io/s/react-with-graphqlapollo-w-datatables-kb2ds?file=/src/components/Jobs/JobsList/index.js
https://codesandbox.io/s/react-with-graphqlapollo-w-datatables-kb2ds?file=/src/components/Jobs/DataTable/index.js
Error messages shown: Cannot extend unknown button type: selected
Description of problem:
I'm using datatables in a React app. Everything seems to work fine except when 'extend: "selected" (or 'extend: "selectedSingle"') is added it gives me the above error. Also, button 'selected' gives a similar error.
options: {
dom: "Blfrtip",
buttons: [
{
// extend: "selectedSingle",
extend: "selected", // this gives an error
text: "My button",
className: "my-button",
action: function(e, dt, button, config) {
const rowData = dt.row(".selected").data();
if (rowData) {
let id = dt.row(".selected").data().id;
alert(id);
}
}
// enabled: true
}
],
select: true
}
Can someone please help. Thanks!
This question has an accepted answers - jump to answer
Answers
Your test case didn't load, but I suspect the problem is that you haven't included the Select extension library. If you look at this example here, ensure you have the necessary files listed on the Javascript and CSS tabs beneath the table.
Colin
Thanks @Colin. I'm not sure why the test case didn't load. I just check the link and it worked. Anyway I have loaded following modules as listed in download page.
But I'll check out your link to see what else is missing.
Seems I have required dependencies loaded. Anyone?
I just tried it again, and yep, it's loading now. It also seem the code is working as expecting - the button is displaying details of the selected row - so I'm assuming the issue is fixed?
Colin
Hey @Colin, thanks for taking the time to get back. The issue I'm having is for one: 'Button' supposed to be disabled until a row is selected. But it's not the case. Second, I'm unable to use for example, 'extend: "selected"' and it throws an error, "Cannot extend unknown button type: selected".
Also this works (referring to row selection by class 'selected')...
but not the following (This code just returns the first row, doesn't matter which row I select) ...
So something is not right with the setup. What am I doing wrong?. Thanks!
Those will be related. As I mentioned above in my first reply, you need to include the Select extension library too, and enable it by setting
select
to true,Colin