Reload Collection datasource

I need to reload a collection datasource after an action in the edit screen. thanks for any help.

my xml looks like as follows for which i want to refresh


  <collectionDatasource id="accountsDs"
                              class="com.company.entity.Account">
            <query>
                <![CDATA[select e from myutil$Account e]]>
            </query>
        </collectionDatasource>
1 Like

You can call the refresh method of the datasource.


 @Inject
    private CollectionDatasource<com.company.entity.Account> accountsDs;

    void myMethod()
    {
        accountsDs.refresh();
    }

I did that before posting, didn’t work (RC6.4).

Let me provide more info. I have two tables in my edit UI when the content of 2nd table comes from Account entity excluding the records available in table 1. When I add few records to table 1, I want to reflect the update in table 1 by excluding them from table 2.

So I think you need two collection data sources. One for table1 and one for table2. Which query did you define for the second data source? Should be something like


select e from myutil$Account e  WHERE e.id NOT IN (...ids from first table...)

Or maybe the TwinColumn component is what you need? I displays two lists and not two tables.

1 Like

Hi
I already have the appropriate SQL used which is working perfectly but as I mentioned, I am looking for the mechanism to refresh the contents from database.