question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular + Datatables all entries by default diaplayed

See original GitHub issue

I’m submitting a…


[ ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[x ] Question

Current behavior

I am using angular+datatables to diplay some jason data from REST API server. Simple. I have a angular service that fetches data from server, returning Observable. Then I subscribe to Observable and receive data in json array. In component template I am using *ngFor directive to display data in html table. Simple. Everything work fine expect that all entries are displayed by default, but it should be only 10 (pageLenght: 10)

<table datatable [dtOptions]="dtOptions" [dtTrigger]="dtTrigger" class="row-border hover compact order-column">
    <thead>
        <tr>
          <th>Broj lokala</th>
          <th>Korisnik</th>
          <th>Funkcija</th>
          <th>Sektor/Pogon</th>
          <th>Služba</th>
          <th>Klasa biranja</th>
        </tr>
      </thead>
      <tbody>
          <tr *ngFor = "let ext of extensions">
            <td>{{ext.extension_num}}</td>
            <td>{{ext.customer_name}}</td>
            <td>{{ext.work_position}}</td>
            <td>{{ext.sub_department}}</td>
            <td>{{ext.department}}</td>
            <td>{{ext.dialing_class}}</td>
          </tr>
      </tbody>
        <tfoot>
            <th>Broj lokala</th>
            <th>Korisnik</th>
            <th>Funkcija</th>
            <th>Sektor/Pogon</th>
            <th>Služba</th>
            <th>Klasa biranja</th>
        </tfoot>

Expected behavior

To display first 10 entries

Minimal reproduction of the problem with instructions

Environment


- node version:
- angular version: 6
- angular-cli version: 6.0.8
- jquery version:
- datatables version:
- angular-datatables version: 

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
l-lincommented, Aug 25, 2018

Can you provide the typescript code?

@ng-model, your issue looks like you forgot to use the dtTrigger, so the HTML is rendered with angular, but DataTable does not know the content.

0reactions
stale[bot]commented, Dec 13, 2020

This issue has been closed due to inactivity. Please feel free to re-open the issue to add new inputs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to show all rows by default in JQuery DataTable
I have tried this code, but it only shows 10 rows by default. $("#adminProducts").dataTable({ "aLengthMenu": [100] });.
Read more >
dataTables shows all rows by default
Hi, I am using dataTables with following settings. ... On reload of my page, I expected it to first show me only one...
Read more >
Page length options - DataTables example
Name Position Office Age Start date Salary Airi Satou Accountant Tokyo 33 2008‑11‑28 $162,700 Angelica Ramos Chief Executive Officer (CEO) London 47 2009‑10‑09 $1,200,000 Ashton Cox...
Read more >
Options - DataTables
dataTable.defaults object. This object takes all of the same parameters as the DataTables initialisation object, but in this case you are setting the ......
Read more >
Setting defaults - DataTables example
This example shows the searching and ordering features of DataTables being disabled by default, which is reflected in the table when it is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found