简体   繁体   中英

How to disable pagination in feathers service?

Hi I try populate my datatable using feathers service in this way:

app.service('pupils').find({}, (error, result) => {

    $('#pupils > table').DataTable({
        "pageLength": view.short,
        "lengthChange": false,
        "info" : false,
        "responsive": true,
        "data": result.data,
        "deferRender": true,
        "columns": [ ... ]
    });

}); 

I have more than 100 testing records but in callback I receive only 10 records. I receive more records after added below code in feathers service:

paginate: {
   default: 100,
   max: 200
 }

but I would like to disable pagination for received all records from mongo. How can I do that?

To disable pagination, remove the paginate option. Not recommended for production however since it might bring down both, the client and the server if you try to send many thousands of records.

Note: the response object changes depending on whether you are using pagination:

Response with pagination: object with data array property

{
   total: 572,
   limit: 50,
   skip: 4,
   data: [/* the data is here */]
}

Response without pagination: the data array

[/* the data is here */]

As @daff already pointed out in the answer above, you can disable Pagination in your configuration, although this is really not recommended.

Also you can disable pagination for a service call once in the service call.

service.find({ paginate:false})

This was discussed on Github here

The documentation for this feature can be found here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM