List page record sorting for entities

Regarding with the ticket [IMPLEMENTED] Ordering of entities
In my opinion, this feature is a must have, since i am managing orders of records manually via sort int column.

I understand that it will conflict with your current implementation, you can make it optionally i think.
Since, we will be giving access of this panel to our clients, without ordering mechanism i am sorry i cannot give this access.

Could it be done via scripting mechanism?

Have you seen this example: https://docs.squidex.io/guides/02-api#usdorderby ?

Yes i saw it, i was talking about the cms page, instead of api. Our clients should be able to sort records.

if you have no time or worries about the conflicts, i can fork and try it actually.

A PR is very welcome. What you can do right now is to create a query and save it as a favorite.

Okay than i wll try my best, since i never worked with angular :slight_smile: can you give me some clues about compiling typescript codes via VS or any cli tool to make the project run. I examined the whole project, and i think i can solve the problem with a couple of changes.
By the way, how can i store/create queries? although I have Sort fields in my entities, when i try this query “$orderBy=Sort desc” it gives me error like no property is defined for workexperience, which is my custom entity.

Also, when I run the project, shims.js and app.js is not found which is probably due to the typescript compilation.

It is described in the docs: https://docs.squidex.io/development/01-developing

In your example you have to use $orderBy=data/Sort/iv desc

Hi there, I created a PR for the need: https://github.com/Squidex/squidex/pull/350 you can check my comment for that I have and havent been able to do so far.

I am very sorry, I am not sure anymore if this is a good idea:

  1. It is expensive, because you have to make an extra query for each insert.
  2. You can get the same ID multiple times when two inserts are done in parallel.
  3. Whenever you make a change like publishing, unpublishing etc. you have to update the order ids.
  4. There is no good consistency as the updates are across multiple entities.
  5. It is not that easy to make an UI for that, what is about multiple pages and so on.
  6. The current PR changes the behavior and is therefore not backwards compatible.

I would just make a parent content item and use references to ensure the order. You can then use GraphQL to fetch the parent with all references.

1 yes you are right and there is no other way for that.
2/4 As far as I know, Orleans handles the concurrency issues, so that multiple same order no values will not be calculated (within the same schema)
3 Publish/unpublish actions there is no need to recalculate the order value since once it is set, it can stay with the same value. Although, there would be gaps for published contents like 1,3,4,7 etc.
5 An angular plugin would be enough to make UI sortable. An xhr request for switching order values of two records is needed.
6 With a migration script or a class that recalculate all empty orderno values on project startup would be enough.

2/4 No thats not correct, only when the calls are done as part of a schema grain, which is not the case.
6. What I mean is the default ordering.

Okay I see, i am working on some parts of my current fork. However, I could not find a part in documentation regarding to the webpack publish side? Could you explain it how I should get a publish for UI project

What do you mean with a “a publish”?

Btw: I am still not sure if I would accept the PR, but of course you are open to have your own fork.

Hi there, for the moment squidex is one of the most valueable cms platforms in my opinion. For this reason, I am very open to support it via a PR. However, it is your decision to accept it, or not actually. I completed the UI side of the implementation and submit it to my master branch actually. If you wish, I can update the PR tomorrow.

Thank you very much. I still do not understand your business case for that.

Hey there, lets think about i am defining products schema. The order of defined products in both cms ui and api returns records based on last modified date by default. However, if i am going to give access to my client, he would be very confused due to the fact that when you have hundreds of products defined, on any modification to single item, it would be moved to the top of the list. But actually, it must preserve its order and stay on the same place. When you have multiple pages of products, it would be confusing.

For this reason, we should keep track of records with an orderno field, which must be calculated on inserts, not updates. Additionally, the customer can change order of items by drag&drop mechanism. My fork does exactly the same. I also changed default sorting to the orderno, instead of last modified date.

Btw, “publish” means making angular code deployable, which was actually npm build as i found in package.json file. Now it works on server and thanks for your both efforts and help about this project.

For your client you could just change the sorting to “created” by. But for products you usually have some defined orders I guess like by price, popularity, rating and so on.