Hello,

I am trying to do an Ajax Refresh for the new tab when I change tabs, but it is not working.  I am using the navigation tabs widget on the OutsystemsWebUI and I have 3 tabs.

First I tried to do this within the TabOnTabChange action where I refreshed the relevant aggregates from the preparation followed by an ajax refresh of the relevant widget.  It did not work.

Next I added a hidden 'Refresh' button on the tab with ajax submit as the method and a 'Refresh' action containing the same refresh logic as above as the destination.  I used the Widget_Click rich widget in the TabOnTabChange action to trigger the 'Refresh' button, but this did not work either.

I have tested initiating the page with each tab as the default tab and the preparation logic for each is working correctly.  It is just the refresh logic when changing tabs that is not working.  Am I missing something or is there another way it needs to be done ?

Cheers, Richard.

Hi Richard,

From what I can understand, you're trying to refresh the contents of a tab whenever the user switches to it, right? If that is the case, then the best place to do it is indeed the Tabs widget's "OnTabChange" event. You can wrap the contents of each tab in containers (don't forget to give them names, so that they can be refreshed through Ajax Refresh) and, in your "OnTabChange" handler, check the value of the "CurrentTab" parameter to determine which container needs to be refreshed.

Aurelio Junior wrote:

Hi Richard,

From what I can understand, you're trying to refresh the contents of a tab whenever the user switches to it, right? If that is the case, then the best place to do it is indeed the Tabs widget's "OnTabChange" event. You can wrap the contents of each tab in containers (don't forget to give them names, so that they can be refreshed through Ajax Refresh) and, in your "OnTabChange" handler, check the value of the "CurrentTab" parameter to determine which container needs to be refreshed.

Hi Aurelio,

Yes this is what I am trying to do.  I have tried the suggestions that you have made but it is not working.

Cheers, Richard.

Hi Richard,

Can you please elaborate a bit more? How exactly is it "not working"?

Aurelio Junior wrote:

Hi Richard,

Can you please elaborate a bit more? How exactly is it "not working"?

Hi Aurelio,

The data of the tab that is being switched to is not being refreshed.

Cheers, Richard.

Hi Richard,

Here's a simple example showing this logic working. Try to compare it to your current implementation to see what's wrong.

Hi Aurelio,

OK, one of the major differences that I am seeing between your example and mine is that I have a different form widget in each tab.  Does this create a problem ?

Cheers, Richard.

Hi Richard,

Ok, so the fact that you're using Forms explains why you don't see the refreshed data. In your OnTabsChange handler, after refreshing the query, you have to reassign the Form's "Record" property. Something like this:


This explicitly tells the form that it needs to refresh because the underlying data has changed. In my opinion, this shouldn't be required, and the platform should be smart enough to figure out automatically that, since the data has changed, the form needs to be refreshed. But there you go.

Aurelio Junior wrote:

Hi Richard,

Ok, so the fact that you're using Forms explains why you don't see the refreshed data. In your OnTabsChange handler, after refreshing the query, you have to reassign the Form's "Record" property. Something like this:


This explicitly tells the form that it needs to refresh because the underlying data has changed. In my opinion, this shouldn't be required, and the platform should be smart enough to figure out automatically that, since the data has changed, the form needs to be refreshed. But there you go.

Hi Aurelio,

That worked, thank you !  Are there any other widgets where this technique needs to be applied e.g. table records, list records, etc ?

I am also having an issue with the same tabbed page where I have defined a hidden default button and in the action for that button, I use the Widget_Click rich widget to activate the relevant button on the active tab.  When I press enter however the hidden default button is not being activated.  Yet if I unhide the default button and click it manually, everything is working as expected.  So for some reason the default button is not activating when pressing enter even thought the 'Is Default' property is set to 'Yes'.  Any ideas on this one ?

Cheers, Richard.