colReorder is not working

colReorder is not working

tvainitvaini Posts: 7Questions: 2Answers: 0

Hi there, I'm facing a problem that colReorder is just not working
I set "colReorder: true" to the $().DataTable() but it seems to take no effect
When I call using new $.fn.dataTable.ColReorder( table, {} ); I get the error "Uncaught TypeError: $.fn.dataTable.ColReorder is not a constructor at..."

I'm using angular 9 and the package versions are
"datatables": "^1.10.18",
"datatables.net": "^1.11.2",
"datatables.net-bs": "^1.11.2",
"datatables.net-bs4": "^1.11.2",
"datatables.net-colreorder": "^1.5.4",
"datatables.net-colreorder-bs4": "^1.5.4"

Below is my DataTable() code

var _table = $('#datatable').DataTable(
{
select: true,
colReorder: true,
}
});

Can someone please help me?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    You're missing the Select extension source files, but that shouldn't affect ColReorder. You've also got an odd mix of 1.10.18 and 1.11.2 for the DataTables component.

    It would be worth looking at those two points, but neither should stop ColReorder from working. Are you able to link to your page so we can take a look. You could also try the debugger, as that will check to ensure the libraries are present on your page,

    Colin

  • tvainitvaini Posts: 7Questions: 2Answers: 0

    Hey Colin, I already have Select extension in source files, I just did not post here. All DataTables package I got is listed below

    "datatables": "^1.11.2",
    "datatables.net": "^1.11.2",
    "datatables.net-bs": "^1.11.2",
    "datatables.net-bs4": "^1.11.2",
    "datatables.net-colreorder": "^1.5.4",
    "datatables.net-colreorder-bs4": "^1.5.4",
    "datatables.net-fixedcolumns": "3.2.6",
    "datatables.net-fixedcolumns-bs4": "3.2.6",
    "datatables.net-fixedheader-bs4": "3.1.5",
    "datatables.net-responsive": "2.2.3",
    "datatables.net-responsive-bs4": "2.2.3",
    "datatables.net-rowgroup-bs4": "1.1.0",
    "datatables.net-scroller-bs4": "2.0.0",
    "datatables.net-select-bs4": "1.3.0",

    I updated the datatables to v1.11.2 but no effect was taken
    I don't have a website yet to send you to take a look, I'm still developing in localhost
    However, I uploaded the data with the debugger, and it generated the code "ivajih"

    Can you please help me?

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    Thank you for the debug code, according to that there are no extensions loaded - only the 1.11.2 core DataTables. It would be worth looking at this page, it's showing how to use DataTables with Angular. You would need to add the extensions too, but that may help guide you through this. Can you try that, please, and let us know how it goes,

    Colin

  • tvainitvaini Posts: 7Questions: 2Answers: 0

    Hey Colin, ty so much for your help
    After installing the packages from the page you sent me, colReorder is working fine!!

    Thanks again for your help

Sign In or Register to comment.