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.

Server side paging only paging direction #1083

@trunglh88

Description

@trunglh88

Before you write your question, please take some extra time to write a good title that is short yet descriptive.

versions using?

  • angular version: 1.5.3
  • jquery version: 2.2.4
  • datatables version: 1.10.15
  • angular-datatables version: 0.6.2

My problem?

If there are 5 pages, when i click page 2 then table show ok, but when click on page 1 then table show page 3, it was only working in one direction (draw param always increase by 1 )

My code

Angular Code

$scope.dtOptions = DTOptionsBuilder
      .newOptions()
      .withOption('ajax', {
        contentType: 'application/json',
        url: 'http://localhost/users?limit=2',
        type: 'get',
        beforeSend: function (xhr) {
          xhr.setRequestHeader('Authorization', 'Bearer ' + localStorageService.get('_token'))
        }
      })
      .withDisplayLength(2)
      .withOption('processing', true)
      .withOption('serverSide', true)
      .withOption('searching', false)
      .withPaginationType('full_numbers')
      .withDataProp('data')
    $scope.dtColumnDefs = [
      DTColumnBuilder.newColumn('id').withTitle('ID'),
      DTColumnBuilder.newColumn('code').withTitle('Code'),
      DTColumnBuilder.newColumn('name').withTitle('Name')
    ]

HTML

<table datatable dt-options="dtOptions" dt-columns="dtColumnDefs" class="uk-table" cellspacing="0" width="100%">
                        </table>

Server Response

'recordsTotal'    => $result->total(),
'recordsFiltered' => $result->total(),
'data'            => $result->toArray()['data'],
'draw'            => $result->currentPage()

please help me to fix this issue urgently.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions