Update Value and Ajax Refresh part of ListValues without Ajax refreshing Entire List

Update Value and Ajax Refresh part of ListValues without Ajax refreshing Entire List

  

I have a page where I am trying to update a value represented in an expression inside of a List Records. The value is referenced from the ListRecords list. (ListRecords1.List.Current.Value)

I want to be able to Ajax refresh just the container containing this particular expression as opposed to the entire ListRecords. 

No matter what I try it does not seem that there is a way to get the ListRecords list to update the values without Ajax refreshing the entire component, as this is causing changes I am not intending. 

Hi Jordan,

When you select a ListRecords to be refreshed in an Ajax-refresh, you can specify the rownumber to refresh. Doesn't that solve your problem?

Lennart Kraak wrote:

Hi Jordan,

When you select a ListRecords to be refreshed in an Ajax-refresh, you can specify the rownumber to refresh. Doesn't that solve your problem?

Thanks for the response! unfortunately in this situation I still need more control than even Row Number.


As it seems, you can also specify a div in a row in the ListRecords. The Ajax-refresh will then only refresh that div in the current row, without the need of specifying the row.

So that is what I'm doing, but I can't seem to get it to pull the new value, if I set it in either the aggregate that the data is originally coming from OR in the list of the ListRecords.

That's where I am having the issue.

You should update it in the RecordList itself, set the ListRecords1.List.Current.Value to the new value and Ajax refresh to show the value in the screen.

If this isn't what you want, maybe you can share an example OML to clearify what the goal is.

So that IS what I'm doing currently, and it does not have that effect. After the Ajax refresh, the expression does not update, The new value is not pulled in from the ListRecords.List.

What exactly do you mean by 'pulled in from the ListRecords.List'?

I mean that even though you have changed a value in the List, it does not update in the expression.

Here is an OML showing what I am talking about.

When you run either ChangeValuesOnAggregate - Refresh Container or ChangeValuesOnList - Refresh Container, you can see no change to the actual values.

If you click "Refresh Whole List" it will refresh, and whatever changes you made in the Aggregate will then be reflected in the list. 

Here it is Live.

I see. I was triggering the action from a link in a row, so the current row was known.

In your case, you need to include the Ajax-refresh in the for-each loop to refresh the row you want. I don't know your business case, but you can choose to refresh when that's needed.

Thanks for spending all this time looking, but this still doesn't solve my problem. I need to NOT refresh the entire row, just a container on that row.

Hi Jordan,

Did you finally manage to solve your problem? I am currently trying to achieve the same thing : refreshing a single container on several rows. I could refresh the entire rows, but I think I would gain in performance if I managed to only refresh the containers.

Thanks!

I haven't yet! I'm definitely still looking.


I've recently found the Event System forge component, and that looks like something that I might be able to use to do something like this, but I have not had time to test it yet.

Solution

Hello Jordan,

You definitely have a problem of difficult resolution.

1. How the Ajax Refresh with Row specified works?

When you Refresh a single row of a list, the only thing that happens is that the specific row is re-rendered.
No data is fetched from the source. If you want to update something, you need to set the new value directly into the ListRecords List[row]. 

But this will refresh the entire line. If you don't change the value in the other fields, they will not change, as nothing is being fetched from the source. This way, you would be, in fact, changing only the desired column.

2. Why can't I refresh a single element in a List Records row?

As far as I know, the reason is that the element you put in the row, in design time, is just a "template", that will be used to construct the elements. So, imagine the following scenario, You have a list and in one of the columns you put a web block. And you give it a name. And you set in a Screen Action an Ajax Refresh to it, and the SS alows it, because it has a name.

Now, during the page construction, the list is build with 5 lines. How the Ajax Refresh will identify which of them you want to refresh, when the action is being executed? In fact, it can't. So, that's the reason why you can't (afaik, again) to refresh a single element inside a row of a list.

Not easily, at least.

3. What about the Event System Forge Component.

In theory, yes, you could use it. It allows you to create listeners in a web block and if the broadcast message has the trigger, that action will be executed. But I would be very cautious about using it. It's "heavy", and rely on very undocumented system features that can change between platform versions, that potentially can impose some limitation or constraints to your application.

So, my recomendation, based on number 1, is to try to use the Ajax Refresh for the entire line, changing the value directly into the ListRecords.List.

Cheers.

Solution

Thank you Eduardo.  I appreciate your thorough and thoughtful response!

I might have to rethink how I am working the list.  In this particular use case, I have a container I want updated, but also a web block with much more information, including accordions, and when I refresh the entire component some things change that I am not looking for.

I will continue to hunt for the best solution, but I think you gave me plenty of information to go on!