Typescript type issues with Bootstrap

Typescript type issues with Bootstrap

droneav8rdroneav8r Posts: 1Questions: 1Answers: 0

Following up on this, I have noticed similar problems with colReorder, bFilter, bSort, and bPaginate

import DataTable, { Config }  from "datatables.net"; // this should not be necessary see https://datatables.net/forums/discussion/comment/221503/#Comment_221503
import jszip from 'jszip';
import pdfmake from 'pdfmake';
import 'datatables.net-bs5';
import 'datatables.net-autofill-bs5';
import 'datatables.net-buttons-bs5';
import 'datatables.net-buttons/js/buttons.colVis.mjs';
import 'datatables.net-buttons/js/buttons.html5.mjs';
import 'datatables.net-buttons/js/buttons.print.mjs';
import 'datatables.net-colreorder-bs5';
import 'datatables.net-fixedcolumns-bs5';
import 'datatables.net-fixedheader-bs5';
import 'datatables.net-keytable-bs5';
import 'datatables.net-responsive-bs5';
import 'datatables.net-scroller-bs5';
import 'datatables.net-searchbuilder-bs5';
import 'datatables.net-searchpanes-bs5';
import 'datatables.net-select-bs5';
import 'datatables.net-staterestore-bs5';

let settings: Config = {
        lengthMenu: [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
        responsive: false,
        colReorder: true, // gives a runtime error $ is undefined
        bFilter: true, // gives not assignable to type Config
        bSort: true,// gives not assignable to type Config
        bPaginate: true,// gives not assignable to type Config
        retrieve: true,
        stateSave: true,
        pageLength: 10,
        deferLoading: 0,
        dom: 'Blfrtip',
}

colReorder give Uncaught TypeError: $ is undefined in the browser dev console
bFilter, bSort, bPaginate complain about not being assignable to Config and fnFormatNumber (not shown) reports that it is not part of type Object.

Are there any workarounds? This project is a .net 6 MVC application with webpack building the client scripts using TypeScript.

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    bFilter, bSort, and bPaginate

    Are legacy parameters. Use searching, ordering and paging instead.

    colReorder give Uncaught TypeError: $ is undefined in the browser dev console

    Can you link me to a page showing that so I can take a look into it please?

    Allan

Sign In or Register to comment.