datatables.net-fixedcolumns-dt and datatables.net-fixedcolumns are not working together

datatables.net-fixedcolumns-dt and datatables.net-fixedcolumns are not working together

mustafa_salaheldinmustafa_salaheldin Posts: 42Questions: 2Answers: 0

Hello
I adding these imports to my Typescript file:
import DataTables from "datatables.net";
import "datatables.net-dt";
import "datatables.net-fixedheader";
import "datatables.net-fixedheader-dt";
import "datatables.net-fixedcolumns";
import "datatables.net-fixedcolumns-dt";
import "datatables.net-responsive";
import "datatables.net-responsive-dt";

but I get the following error in VS2022:
error TS2307: Build:Cannot find module './FixedColumns' or its corresponding type declarations.
error TS2717: Build:Subsequent property declarations must have the same type. Property 'fixedColumns' must be of type 'boolean | ConfigFixedColumns', but here has type 'boolean | ConfigFixedColumns'.
error TS2717:Build:Subsequent property declarations must have the same type. Property 'fixedColumns' must be of type 'ConfigFixedColumnsLanguage', but here has type 'ConfigFixedColumnsLanguage'.
error TS2717:Build:Subsequent property declarations must have the same type. Property 'FixedColumns' must be of type '{ new (dt: Api<any>, settings: string[] | ConfigFixedColumns | ConfigFixedColumns[]): any; version: string; defaults: ConfigFixedColumns; }', but here has type '{ new (dt: Api<any>, settings: string[] | ConfigFixedColumns | ConfigFixedColumns[]): any; version: string; defaults: ConfigFixedColumns; }'.

If I remove the
import "datatables.net-fixedcolumns-dt";
the error goes away, I'm using webpack, any advise?

Replies

  • mustafa_salaheldinmustafa_salaheldin Posts: 42Questions: 2Answers: 0


    Can't figure out why, even adjusted the forceConsistentCasingInFileNames but no help.

  • mustafa_salaheldinmustafa_salaheldin Posts: 42Questions: 2Answers: 0

    Severity Code Description Project File Line Suppression State Error TS2769 (TS) No overload matches this call.
    Overload 2 of 3, '(opts?: Config): Api<any>', gave the following error.
    Argument of type '{ fixedHeader: true; responsive: true; searchHighlight: true; searching: true; fixedColumns: boolean; paging: false; order: (string | number)[][]; columns: ({ orderable: false; width: string; responsivePriority: number; } | { ...; })[]; autoWidth: false; }' is not assignable to parameter of type 'Config'. Object literal may only specify known properties, and 'fixedColumns' does not exist in type 'Config'. H:\Workshop\BIM Catalyst\Web Apps\Autodesk Forge SDK\BIM360PP\src\tsconfig.json H:\Workshop\BIM Catalyst\Web Apps\Autodesk Forge SDK\BIM360PP\src\Components\files-table.ts 675 Active

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    If you just use:

    import "datatables.net-dt";
    import "datatables.net-fixedheader-dt";
    import "datatables.net-fixedcolumns-dt";
    import "datatables.net-responsive-dt";
    

    does it then work for you? The -dt packages depend on their core packages, so you don't need to include both.

    If that doesn't fix it, can you create a demo git repo that shows that issue please?

    Allan

  • mustafa_salaheldinmustafa_salaheldin Posts: 42Questions: 2Answers: 0

    Hello @allan
    I've created this repository, and unfortunately the Datatables is not identifies as JQuery plugin: :(
    https://github.com/mustafasalahuldin/Using-datatables.net-in-.Net-7

  • mustafa_salaheldinmustafa_salaheldin Posts: 42Questions: 2Answers: 0

    I fixed the issue by installing the jquery types, butt still can't use the fixed columns and other attributes

Sign In or Register to comment.