Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Refreshing NatTable
Refreshing NatTable [message #1222478] Fri, 20 December 2013 14:28 Go to next message
Victor Alcantara is currently offline Victor AlcantaraFriend
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 18:28 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2903
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:how to remove configuration
Next Topic:Issue with ColumnReorder and Refresh
Goto Forum:
  


Current Time: Tue Sep 24 23:30:29 GMT 2024

Powered by FUDForum. Page generated in 0.03494 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top