49
Views
5
Comments
Sortable row number in table with dynamic sorting
Application Type
Reactive
Service Studio Version
11.54.12 (Build 62475)

Hi everyone, I'm trying to build a simple table with a number column, example image:

I've managed to show the row number by using expression on the table body: StartIndex + CurrentRowNumber + 1

Now, the tricky part is making the number column sortable and retains their number value.
For example in this example Patricia have the row number of 1, in case the user sort the table using the FirstName column, Patricia would end up having the row number of 55 (the last number).

 I was hoping for a way to pair up the list itself with their row number, so each list have a static row number that can be sortable.

Is there any way to do this? What comes to my mind is to create a custom attribute in the aggregate itself, but I haven't be able to figure out the how. Thanks in advance!

2022-01-13 11-06-04
Neha Sheikh
Champion

Hello,

I think this can only happen if the S.no column is coming as an output of aggregate. Either you have to create a calculated column for Sr.No or You have to add that column in the entity itself.

Thanks,

Neha

UserImage.jpg
Dawn_

Hi Neha,

I've suspected as much and was hoping to find an easier solution as I'm having trouble figuring out the appropriate formula for the calculated column.

Would you mind giving an example (let's say the default sorting is by First Name)?

Regards,
StillLearning

2021-09-06 15-09-53
Dorine Boudry
 
MVP

You are the only one who can answer that question, StillLearning.

What is the meaning of that row number?  Why do you want it there, who is going to do anything with it, how and by what users is it going to be used, and who decides that Justin should be number 54, and what if a new entry with name July gets added ,does that mean Justin is no longer number 54 ??

UserImage.jpg
Dawn_

Hi Dorine,

I'm sorry if I may have not explain my intentions clearly. I'm trying to bind the row number assigned by the default sorting.
And yes, if a new entry gets added  (July), then July should be number 54 and Justin would be 55. I understand that it may seem that I'm overcomplicating something miniscule, but I imagine some users would like to go to the last records simply by sorting the row number instead of going all the way to the last page.

Regards,
StillLearning

2021-09-06 15-09-53
Dorine Boudry
 
MVP

So what is your default sorting ?? if it is for example firstname, then you don't need a 'rownumber' your users can just sort on firstname descending for this, really don't get what an extra number can add to this.

If you have no initial value for the sort variable, that's a different story altogether, then the records come out I think based in some way the DBMS chooses, I think it likely to be the identifier then, but I'm not sure that is guaranteed.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.