Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Refreshing NatTable
Refreshing NatTable [message #1222478] Fri, 20 December 2013 09:28 Go to next message
Victor Alcantara is currently offline Victor Alcantara
Messages: 4
Registered: December 2013
Junior Member
Hello, I am migrating my tables for NatTable and I have started to learn about it.
I have a basic aplication using SWT which I am saving the data on a database and showing on a nattable and I am trying to refresh it, but isn't work.

In my AddButton after save data in a database I am calling the refresh() method.

Like this:

//Add new employee
Button btnAdd = new Button(this, SWT.NONE);
btnAdd.setImage(SWTResourceManager.getImage(EmployeeView.class, "/img/add-user.png"));
btnAdd.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
Session session = factory.openSession();
Transaction tx = null;
try{
tx = session.beginTransaction();
Employee employee = new Employee();
employee.setFirstName(textFirstName.getText());
employee.setLastName(textSecondName.getText());
employee.setSalary(Double.parseDouble(textSalary.getText()));
session.save(employee);
tx.commit();

}catch (HibernateException e) {
if (tx!=null) tx.rollback();
e.printStackTrace();
}finally {
session.close();
}

tableEmployee.refresh();
cleanFields();
}

});

Could anyone help me?
Re: Refreshing NatTable [message #1222544 is a reply to message #1222478] Fri, 20 December 2013 13:28 Go to previous message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1255
Registered: July 2012
Senior Member
From your code I can't say anything as there is no NatTable related code.

Usually that kind of issues are related to the IDataProvider. Do you ensure that it gets an update? A typical composition is to set a list of values. If you don't update that list NatTable does not know about updated data.
Previous Topic:Issue with FilterRowComboBoxCellEditor
Next Topic:Issue with ColumnReorder and Refresh
Goto Forum:
  


Current Time: Fri Aug 22 19:40:31 EDT 2014

Powered by FUDForum. Page generated in 0.01515 seconds