How you choose which values become available into the Sort listbox?

Hi,
I would like to select dates to sort my articles but I see only this :

@xmasrock

I might need to add support for that, will check it later on today.

1 Like

@dejan , I’m interested having the capability to choose sort, especially on dates

@xmasrock

Please share you domain name again and also let me know when Strapi is live so I can add sort by date.

@dejan
temlab.divhunt.art
Strapi live now

@dejan : probably that the sorting capability should also be available when defining an iterator

@xmasrock

Try now. Also I have to go, but will back on approx 4h, so I will check your response later.

@dejan It works like a charm for most of my usecases.

However, I would love to define the sort for iterables.
Example: in the article category, I’m displaying all articles using an iterable to navigate the relationship. I would love to get articles sorted with most recent article first and probably latest 10 articles only

and to go even further, even if I don’t have this need for now, but filtering/pagination would be wonderful

ping @dejan for the sort, number of rows, filter on iterable. Some news on your plan ?

@xmasrock

Not sure about this one, it’s bit limited for sources on page. You can call another source inside page to get list of what you need with proper sorting for now.

Humm I see. However, it means getting another call for data which is already in the data structure.

If I understand correctly, it is a better approach to have several sources defined than only one with a a big data structure in response. It could potentially have a better response time.
Correct?

@xmasrock

You can have up to 10 source calls per single page. So there’s nothing wrong if you have sources on single page.

But there are few things you might want to avoid:

  1. Nested sources (source in source. Meaning if first source returns 20 items, then 21 total sources will be executed, and the limit is 10, so the loading of rest sources will slow down (won’t effect website load time, just that source part)

  2. Having more than 10 sources. First 10 sources will load instantly, the rest will be delayed, as there is limit of 10req/s on API for sources.

Other than that, feel free to have up to 10 sources without worrying anything, sources does not slow down your website, since they are executed once entire page shows (except single pages).

So in my opinion, we should keep the source on pages (single pages) as minimum as possible, and then use tag sources to show other data.

But, nonetheless I would like that we add option for single sources (on page) to have also options like sorting, or depending what source has from options.