37
Views
4
Comments
Solved
Refresh data in a list of records (REACTIVE)
Question
Application Type
Reactive
Service Studio Version
11.54.24 (Build 62760)


I'm making a registration page, and one of the data requested on the page is the address. However, I'm doing an autofill based on the CPF, that is, when I type a CPF, a PopUp opens with the addresses related to that CPF, so the person selects 1 and the address fields are automatically filled in. However, when you click on an address in the PopUp, it always fills in the same address. I think I need to do an refresh, but I can't do it.

I'm pulling the data through a Server Action.




End2.png
End1.png
End3.png
Champion
Solution

Hi @vn_perpetuo ,

Your problem is that in your popup address onClick action (action triggered when you click one address in the popup), you are filling the Endereco, Bairro, Cep, Cidade, from your server action consultarEnderecos.enderecos.current, which is WRONG. 

Solution:

You call consultarEnderecos action only once, and assign it to your Enderecos (address list) local variable, like you did, which is the source of your popup list widget. 

Then when you click on a specific one, on the OnClick assign you will use the Enderecos.current to make assigns, not the ConsultarEnderecos.enderecos.current.

Remember that your list source is your local variable Enderecos, which is already filled with data from the action/API at the beginning when you open the popup, so you need to work with that local variable, not call the action again and use the current of the action


Let me know if this helped you,

Paulo

Hello. It worked, thank you very much. 

Champion

Hello,

It's reactive... SO it means if you set the value in the correct variable this will be changed automatic in your screen.

Hello,

Please check which value you are passing while selecting a specific address.
For example: In your case  lets say I have an Address aggregate which have multiple addresses So when I am going to select that address from the list I will pass the Address Id to the Service action and then In the service action I will filter the data of Address by Id and will pass the result through the output parameter.
So it will automatically change the data and will reflect in your screen.

Hope it helps you..

Regards,

Pavan R


Champion
Solution

Hi @vn_perpetuo ,

Your problem is that in your popup address onClick action (action triggered when you click one address in the popup), you are filling the Endereco, Bairro, Cep, Cidade, from your server action consultarEnderecos.enderecos.current, which is WRONG. 

Solution:

You call consultarEnderecos action only once, and assign it to your Enderecos (address list) local variable, like you did, which is the source of your popup list widget. 

Then when you click on a specific one, on the OnClick assign you will use the Enderecos.current to make assigns, not the ConsultarEnderecos.enderecos.current.

Remember that your list source is your local variable Enderecos, which is already filled with data from the action/API at the beginning when you open the popup, so you need to work with that local variable, not call the action again and use the current of the action


Let me know if this helped you,

Paulo

Hello. It worked, thank you very much. 

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