Refresh table after inserting value in database

Hi. How can I update a table right after inserting some rows inthe database? I need to update the table after the user inserts somes values By pressing a button. I am aware of the Timer component but what I really need is a way to refresh the table.

Best

André

Hi Andre,

Use refresh() method of the table’s datasource. For example:


@Inject
private CollectionDatasource<MyEntity, UUID> myEntitiesDs;

public void onButtonClick() {
    myEntitiesDs.refresh();
}

Hi,

I needed it too, but somewhy in Eclipse I got ‘Bound mismatch’ for my entity.

Here is the code:


package com.company.gdpr.web.customers;

import java.util.UUID;

import javax.inject.Inject;

import com.company.gdpr.entity.Customers;
import com.haulmont.cuba.gui.components.AbstractLookup;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.data.CollectionDatasource;

public class RendelkezesekBrowse extends AbstractLookup {
	@Inject
	private CollectionDatasource<Customers, UUID> customersDs; //Here i got for Customers

    public void onRefreshBtn(Component source) {
    	customersDs.refresh();
    }
}

Could you help me what I wrong?
Thanks

Please provide XML descriptor of the RendelkezesekBrowse screen, at least in the part where customersDs is defined. Also, what is the base class of the Customers entity?

Sorry, RendelkezesekBrowse is CustomersBrowse, I just forgot to rename, but thanks, your answer here solved my question!

A post was split to a new topic: How to refresh data of Table