appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
34.59k stars 3.73k forks source link

[Feature] Pagination settings tab for API #2357

Open areyabhishek opened 3 years ago

areyabhishek commented 3 years ago

Summary

This is necessary for all databases except for Redis.

  1. Show table options to choose from
  2. Show specific queries for the database being queried(different for each database)
  3. Also show these examples in the documentation
jmcouffin commented 3 years ago

Rest API

allowing to query all the data through pagination but on the ressource side would make life easier. Having to create either a table where you collect multiple queries or using the pagination on server side is both inefficient and overwhelming on a user standpoint. a simple tick box that asks you with which paramater name you will paginate would remove the hassle

Nikhil-Nandagopal commented 3 years ago

Hi @jmcouffin could you elaborate this a bit? Today you can configure the pagination for an API by specifying the next / previous URLs or the page number in the query parameter. How do you propose we achieve this with a tick box?

jmcouffin commented 3 years ago

@Nikhil-Nandagopal Maybe pagination is not exactly the term I should use. I don't want to build a table with all the data but maybe grab the list of item.name and item.id and be able to use it in a dropdown. using a restAPI, sometimes it is ok to grab only the first 100 items, but sometimes I would need my query to fetch every items at once going through all the pages (and building all the queries by itself) UI/UX wise I would need to provide:

jmcouffin commented 3 years ago

all in all I don't want to grab pages as I go through a table. I wan't it all at once 😄

Nikhil-Nandagopal commented 3 years ago

@jmcouffin are you using an API or an SQL datasource? Are you talking about generating the queries for the database table? Does the process described here not work for you? https://docs.appsmith.com/core-concepts/displaying-data-read/display-data-tables#offset-based-pagination

Sorry, I'm a little confused about the proposed solution. If you have an API I think it would have it's own specific interface which we would need to comply to and so you would need to configure that interface which is possible today.

jmcouffin commented 3 years ago

@Nikhil-Nandagopal I am no coder, so bear with me. Just an architect who starts to like coding.

RestAPI, the asana and harvest ones in particular. in both, I have projects, which are like a starting point to fetch everything. Then once I select the project and its id, I am good to go. UI wise, I wan't people to be able to select from the complete list of projects, not only the first 100s.

I bypassed the issue going through a table where I concatenate 3 prebuilt queries that do grab one page each.

The link you sent works but only in table widgets, and in a way that even if I sort the first 0-100 of items on the first page, I might get the next 100-200 items sorted but not with a sorting starting from the previous item #100

Nikhil-Nandagopal commented 3 years ago

@jmcouffin I think I understand the problem is to be able to perform pagination in a dropdown and that is not possible because the dropdown doesn't have an onPageChange option. So you'd like to be able to paginate the dropdown. Looking at the Asana and Harvest API documentation, it seems that neither supports sorting as a parameter of their API calls thus it wouldn't be possible to get page2 (100-200) with 100 starting from the previous value of 99

jmcouffin commented 3 years ago

Exactly @Nikhil-Nandagopal That why I have to grab all the data then sort it