l-lin / angular-datatables

DataTables with Angular
https://l-lin.github.io/angular-datatables/
MIT License
1.57k stars 481 forks source link

Angular 15 Data table resposive is not working #1742

Closed dineshnirali closed 4 months ago

dineshnirali commented 1 year ago

Hi , I am using angular 15
"bootstrap": "^5.3.0", "datatables.net": "^1.11.3", "datatables.net-dt": "^1.11.3", "datatables.net-responsive": "^2.4.1", "datatables.net-responsive-dt": "^2.4.1", "jquery": "^3.6.0",

angular.json

 "styles": [
              "src/styles.scss",
              "node_modules/datatables.net-dt/css/jquery.dataTables.min.css",
              "node_modules/datatables.net-responsive-dt/css/responsive.dataTables.css"
            ],
            "scripts": [
              "src/assets/js/prettify.min.js",
              "node_modules/jquery/dist/jquery.min.js",
              "node_modules/datatables.net/js/jquery.dataTables.min.js",
              "node_modules/datatables.net-responsive/js/dataTables.responsive.js"
            ]

html code

 <table datatable [dtOptions]="dtOptions" class="row-border w-100 table  hover">
                <thead>
                  <tr>
                    <ng-container *ngFor="let col1 of columns;">
                      <th>{{col1.name}}</th>
                    </ng-container>
                  </tr>
                </thead>
                <tbody>
                  <ng-container *ngFor="let col of tableCompanyData;let i= index;">
                    <tr>
                      <ng-container *ngFor="let col1 of columns">
                        <td>{{col|common:'getVal':col1['key']}}</td>
                        </ng-container>
                    </tr>
                    </ng-container>
                </tbody>
              </table>

ts file

 this.dtOptions = {
      searching:false,
      paging:false,
      ordering:false,
      responsive:true,
      columnDefs: [
        {  className: 'all',  targets: '_all' } // apply for all columns
      ],
      pagingType: 'full_numbers',

    };

Screenshot 2023-06-19 at 09-24-02 Mojopms

Plz help out

shanmukhateja commented 10 months ago

Hi, you seem to be using HTML code to initialise the library.

We have deprecated this use case due to bugs and inconsistencies some of which have been listed in ourFAQ page.

I will keep this issue open so soemone else may assist you.

shanmukhateja commented 4 months ago

Closing the ticket as the answer provided is adequate and no new responses have been provided.

Feel free to re-open if required.