pagination doesn't work with custom data from json file
See original GitHub issueI am using custom data from .json file and want to paginate the data but all data comes in single page ; why so? below are my code
$http.get('app/user_keys.json').success(function(data) {
vm.data = data;
vm.tableParams = new NgTableParams({ page: 1, count: 2 }, {
total: vm.data.length,
getData: function (params) {
console.log(vm.data.length);
var deferred = $q.defer();
var orderedData = params.sorting() ? $filter('orderBy')(vm.data, params.orderBy()) : vm.data;
deferred.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
});
<table ng-table="vm.tableParams" class="table table-striped" >
<colgroup>
<col width="5%"/>
<col width="30%"/>
<col width="50%"/>
<col width="15%"/>
</colgroup>
<tr ng-repeat="row in vm.data | filter: searchText track by $index">
<td header="'headerCheckbox.html'">
<input type="checkbox" value="row._id" ng-model="vm.checkboxes.items[row._id]" ></td>
<td data-title="'ID'">{{ row.index }}</td>
<td data-title="'Cloud Location'">{{ row.location }}</td>
<td data-title="'Action'"><i class="fa fa-trash"></i></td>
</tr>
</table>
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:10
Top Results From Across the Web
Custom data source property dataSrc and pagination issue
SOLUTION. Set parameters draw , recordsTotal and recordsFiltered as top-level properties of JSON response where DataTables expects them to be.
Read more >Pagination issue using datatables, JSON url datasource, Jquery
Hi I am using JQUERY to load a JSON url data using Server side processing. The issue I am having is that, all...
Read more >Ajax (remote data) - The jQuery replacement for select boxes
Select2 supports pagination ("infinite scrolling") for remote data sources out of the box. To use this feature, your remote data source must be...
Read more >The List Component - React-admin - Marmelab
Default layout components ( <Datagrid> and <SimpleList> ) return null when the data is loading. If you use a custom layout component instead,...
Read more >Database: Pagination - The PHP Framework For Web Artisans
This is done so that the paginator knows how many pages of records there are in total. However, if you do not plan...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok I fixed it, it’s because
dataOptions
may beundefined
. So the code should beI’ve same problem, when paging on group data. So, i add these lines at the end on getGroups function.
The pagination working on either used default or custom.