Table Records select Row after return from Popup

Table Records select Row after return from Popup

  

Good day Community,

I hope to get some held on the following;

Scenario:

I have a List page with a table records widget that displays my content, which calls a popup to create or edit a record.

Problem:

I would like to highlight, activate or "select" the record that I just created in the record list.  I don't want to return the single record by "filtering" the aggregate with the ID that was returned with the NotifyGetMessage server action.  I want to be able to "navigate" to the record and later on style the record so that it stands out from the other items. 

How do I make the record selected?

Thanks 

Hello Tjaart,

"Highlight" and "select" are 2 different things. One is purely visual, the other has impact in the application "status". So, if you click in a line of a Table Records, the Table.List.Current will be set to that line (state change).

If you need only to apply a different style to a line for a newly created record, this is much simpler in a List Records than a Table Records, as you can envelope each line in a Container, for example, and apply dynamic style to it, through the Extended Properties (either style or class), based on some condition (for example, if the CurrentRowNumber or Record Id is the one is to be styled differently).

For a Table Records, this can be much more complex, as it has a predefined style and is not so flexible to change.
I made an example using the Cell extended properties to change the background when clicked, using a local variable to store the id clicked in the name.

https://eduardojauch.outsystemscloud.com/TableStyleLine/HomeScreen.aspx

You can adapt it to your needs.

Cheers,
Eduardo Jauch

Hi Eduardo,


Thank you for clearing up highlighting vs selecting, also thank you for your prompt response.

My problem is not in the styling or setting apart the record, I would like to have the OnNotify set the record as selected and have the navigation etc in the right position, so if I have 100 Records that only have 5 rows visible and my record's first letter is "o", this making it number 71 in the list if sorted alphabetically, I would like the table to refresh and have row 71 visible among the other 5 records.  I would then apply the styling as per your example, thanks for sharing.

Cheers

Tjaart Swanepoel

Hello Tjaart

Sorry for taking long to answer, and for misunderstanding your problem.

Right now, I have a question. You want the row 71 to be ADD to the end/start of the list, or you want to navigate to the page where the line is?

In the first case, the only way to do this without "messing" with your list (even more if you use pagination) is to add the line "outside" the table, but than you would have a problem with styling it...
Other possibilities would involve messing with the Table List or moving/inserting the desired row to the correct position in the aggregate list, change dynamic (through a variable) the number of lines in the Table/List Records and refreshing it in the screen.

If you want just to move to the page where the new item is, you can use the:

List_Navigation_GetStartIndex

It has a third parameter that can be used to defined the new Start Index for the list. You would have to find the correct Starting index based on the number of lines to show, and number of lines per page, what implies you need to find this through an extra aggregate, probably. 

I have an example where you can set a page and navigate to it, you can adapt it to your use case: https://eduardojauch.outsystemscloud.com/TableStyleLine/Home.aspx

Cheers,
Eduardo Jauch

Hi Eduardo,

Apology for the late reply, your example gets me closer to what I want to achieve, since I do not know what the position of a record is when I save the new record, how do I refresh the widgets and table, so that the newly saved record is visible and the pagination widget is in the right spot.

Thanks,

Tjaart Swanepoel

Hello Tjaart,

Here I think you have, probably, a single solution (that I can think of, right now).
When you insert the record you will receive the id.
With it, you go fetch the information the way you do in preparation, and find the page and start index of the first row in this page where the new record is. This is the "extra aggregate" I mentioned before. 

The other option is to do some kind of Advanced SQL that will return the number of the row where the page where the new record is, starts. Probably would be more effective, but would not be a simple query, I think.

I'm not seeing any other way to do this... (But maybe there is)

Cheers,
Eduardo Jauch

yup, 2 queries I think (or 1 advanced but I don't recommend that)


- fetch rownumber of that specific id

- do the normal aggregates with calculated startindex.


Hello Eduardo

Another good explanation how to select a row.

I would like to add a questions

Instead we use a link to select a row there is any way that we can select by clicking in any part of the row?


TIA

Hello Alberto, 

Try the following link 

https://www.outsystems.com/forums/discussion/9426/is-it-possible-to-use-an-onclick-event-on-a-row-in-a-list-to-perform-an-action/

We use the idea but cell by cell. 

Hope it help

Graça

Hello Alberto,

Graça pointed to a nice post, because you can find at least 3 different ways to do this there :)
There is also a component in the forge, that has a web block that helps this (but I never used it).

Cheers,
Eduardo Jauch

Thanks again Graça and Eduardo !!