{"action":"created","issue":{"url":"https://api.github.com/repos/swimlane/ngx-datatable/issues/714","repository_url":"https://api.github.com/repos/swimlane/ngx-datatable","labels_url":"https://api.github.com/repos/swimlane/ngx-datatable/issues/714/labels{/name}","comments_url":"https://api.github.com/repos/swimlane/ngx-datatable/issues/714/comments","events_url":"https://api.github.com/repos/swimlane/ngx-datatable/issues/714/events","html_url":"https://github.com/swimlane/ngx-datatable/pull/714","id":224271568,"number":714,"title":"Server pagination fix","user":{"login":"dcesiel","id":1328850,"avatar_url":"https://avatars0.githubusercontent.com/u/1328850?v=3","gravatar_id":"","url":"https://api.github.com/users/dcesiel","html_url":"https://github.com/dcesiel","followers_url":"https://api.github.com/users/dcesiel/followers","following_url":"https://api.github.com/users/dcesiel/following{/other_user}","gists_url":"https://api.github.com/users/dcesiel/gists{/gist_id}","starred_url":"https://api.github.com/users/dcesiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcesiel/subscriptions","organizations_url":"https://api.github.com/users/dcesiel/orgs","repos_url":"https://api.github.com/users/dcesiel/repos","events_url":"https://api.github.com/users/dcesiel/events{/privacy}","received_events_url":"https://api.github.com/users/dcesiel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-04-25T21:03:48Z","updated_at":"2017-04-30T00:34:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/swimlane/ngx-datatable/pulls/714","html_url":"https://github.com/swimlane/ngx-datatable/pull/714","diff_url":"https://github.com/swimlane/ngx-datatable/pull/714.diff","patch_url":"https://github.com/swimlane/ngx-datatable/pull/714.patch"},"body":"This change addresses #138.  You can try it using `npm i @dcesiel/ngx-datatable`\r\n\r\nTODO:\r\n1. Add documentation for change.\r\n2. Modify server paging demo for change.\r\n\r\n**What kind of change does this PR introduce?** (check one with \"x\")\r\n- [x ] Bugfix\r\n- [ ] Feature\r\n- [ ] Code style update (formatting, local variables)\r\n- [ ] Refactoring (no functional changes, no api changes)\r\n- [ ] Build related changes\r\n- [ ] CI related changes\r\n- [ ] Other... Please describe:\r\n\r\n**What is the current behavior?** (You can also link to an open issue here)\r\nCurrently ngx-datatable calculates a non-zero first index in BodyComponent.updateIndexes() when server pagination is selected.  This becomes an issue when using standard pagination such as [spring-data pagination](http://ankushs92.github.io/tutorial/2016/05/03/pagination-with-spring-boot.html) where the first value in the results array will be the value at the specified offset in the request.\r\n\r\n\r\n**What is the new behavior?**\r\nBecause the server is handles grabbing the page subset for us, the first index calculated by BodyComponent.updateIndexes() should always be 0 and the last should be 0 + pageSize.\r\n\r\n\r\n**Does this PR introduce a breaking change?** (check one with \"x\")\r\n- [ x ] Yes\r\n- [ ] No\r\n\r\n\r\nIf this PR contains a breaking change, please describe the impact and migration path for existing applications: ...\r\n\r\nThe externalPaging config flag has been deprecated in favor of serverPaging which behaves the same way except for the index calculation change.\r\n\r\n**Other information**:\r\n"},"comment":{"url":"https://api.github.com/repos/swimlane/ngx-datatable/issues/comments/298203226","html_url":"https://github.com/swimlane/ngx-datatable/pull/714#issuecomment-298203226","issue_url":"https://api.github.com/repos/swimlane/ngx-datatable/issues/714","id":298203226,"user":{"login":"rafaelss95","id":11965907,"avatar_url":"https://avatars3.githubusercontent.com/u/11965907?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelss95","html_url":"https://github.com/rafaelss95","followers_url":"https://api.github.com/users/rafaelss95/followers","following_url":"https://api.github.com/users/rafaelss95/following{/other_user}","gists_url":"https://api.github.com/users/rafaelss95/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelss95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelss95/subscriptions","organizations_url":"https://api.github.com/users/rafaelss95/orgs","repos_url":"https://api.github.com/users/rafaelss95/repos","events_url":"https://api.github.com/users/rafaelss95/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelss95/received_events","type":"User","site_admin":false},"created_at":"2017-04-30T00:34:21Z","updated_at":"2017-04-30T00:34:21Z","body":"Hello, I've installed this package and after hours trying to make the externalPaging I've found this thread..\r\n\r\nSo, I've installed it using `npm i @dcesiel/ngx-datatable`, but I'm getting the same behavior:\r\n\r\nThe `rows` variable isn't being updated for some reason. It only displays correct on page load, in other words, for the first page.\r\n\r\nI put a `console.log(this.rows)` and it displays correct, but the view isn't being updated. How can I solve this?\r\n\r\nHere's my actual code:\r\n\r\n` <ngx-datatable class=\"material\"\r\n  columnMode=\"force\" \r\n  [count]=\"count\" \r\n  [cssClasses]=\"cssClasses\" \r\n  [externalPaging]=\"true\" \r\n  [externalSorting]=\"true\" \r\n  [footerHeight]=\"50\" \r\n  [headerHeight]=\"50\" \r\n  [limit]=\"20\" \r\n  [offset]=\"0\" \r\n  [rows]=\"items\" \r\n  rowHeight=\"auto\" \r\n  (page)=\"handlePageChange($event)\"\r\n  (sort)=\"handleSortChange($event)\">\r\n  </ngx-datatable>`\r\n\r\n  ```\r\npublic fetchData = (params: { [key: string]: any } = {}): void => {\r\n    this.myService.getAll(params)\r\n      .finally(() => this.loading = false)\r\n      .subscribe(\r\n        (data: any) => {\r\n          this.count = data['meta']['total'];\r\n          this.rows = data['myKey'];\r\n          console.log(this.rows); // It's correct\r\n          // this.rows = this.rows.slice(); -> Attempt\r\n        },\r\n        (err: any) => {\r\n          this.handleError(err);\r\n        }\r\n      );\r\n  }\r\n\r\n  public handlePageChange = (event: { [key: string]: number }): void => {\r\n    const {limit: by_limit, offset: by_offset} = event;\r\n    this.fetchData({by_limit, by_offset});\r\n  }\r\n```"}}
{"actor":{"display_login":"rafaelss95"}}