Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

pageLength not working as expected in angular datatable server side response #1646

@srijanlama

Description

@srijanlama

🪲 bug report

pageLength = 2 not returning expected result on datatable

  ngOnInit(): void {
    const that = this;
    this.dtOptions = {
      pagingType: 'full_numbers',
      pageLength: 2, // this should return datatable of page length 2 
      serverSide: true,
      processing: true,
      ajax: (dataTablesParameters: any, callback) => {
        that.http
          .post<DataTablesResponse>(
            environment.api_url + `job/manpower`,
            dataTablesParameters,
            {}
          )
          .subscribe((res: any) => {
            that.jobs = res.data;
            callback({
              recordsTotal: res.recordsTotal,
              data: [],
            });
          });
      },
      columns: [{ data: 'id' }, { data: 'title.en' }],
    };
  }

server api response

api-data

request payload

payload

datatables shows more than 2 records

SajhajobsFrontend

  • NodeJS version: 14.15.1
  • Angular version: 13.1.0
  • Angular CLI version: 13.1.0
  • jQuery version: ^3.6.0
  • DataTables version: 1.11.3
  • angular-datatables version: ^13.0.1

any help is Appreciated
Sri Zn

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions