Refresh fragment or call method in fragment from host screen

How can I refresh fragment or call method in fragment from host screen.
In cuba i was calling a refresh method in fragment to refresh its data.



Take at Using Screen Fragments docs. If doc doesn’t cover your needs, please describe your task in more detail.


@gorelov, I have already gone through this number of times but still not able to figure out the solution.

Screenshot 2022-06-27 181356

I am using fragments as counters in my browse screen declared declaratively in XML. The fragment counter depends on the records of entity which can change in browse screen. There is a refresh method in fragment which when call set the new counter value based on records. In cuba i was calling this method every time when there is any change in data.

public void refresh()

How can i call this refresh method from browse screen every time there is change in data to update the counter?

If fragments are added declaratively, i.e. in XML, then you need to define id attribute for them, inject in host screen and call their methods.

id of fragment is already there but its method can.t be called. As you can see no refresh() method is visible.

Screenshot 2022-06-28 fragment

This is refresh method in fragment

public void refresh()

This declaration of fragment in xml

>   <col sm="12" md="3">
>                     <fragment screen="com_PendingComplianceTask" id="fragment1"/>
>       </col>

Please advice

Simply cast fragment to a specific class.

1 Like