Tuesday, March 31, 2015

update checkbox after asking the server

Hi,

I have a CellTable. One of the columns is build like this 
Column<MyProxy, Boolean> colIsReference =
new Column<MyProxy, Boolean>(new CheckboxCell()) {
@Override
public Boolean getValue(MyProxy rdm) {
return Boolean.valueOf(rdm.isReference());
}
};
colIsReference.setFieldUpdater(new FieldUpdater<MyProxy, Boolean>() {
public void update(final int index, final MyProxy rmd, Boolean value) {
  dataUpdater().setReference(
rmd,
value.booleanValue(),
false, // don't override current reference (opens dialog if there is another reference)
new Runnable() {
// called if canceled
public void run() {
      // --->  Do something that unchecks the checkbox  <---
  }
}
   );
}
});

When the user clicks the checkbox of an entry, the server checks if the value may be changed easily at the moment. If yes, I don't have a problem.
If not (some other things have to be changed too) - I ask the user if he wants to change all necessary stuff. The user can click ok or cancel. If he clicks ok, I have no problem. But if the user cancels I want to uncheck the checkbox again.

Whats the best way to do that? I tried to update the table with setRowData (because in my proxy in rmd the flag is still false!) and I have tried with the updateRowData of the asyncDataProvider that I use.

Is there a way to bind the gui closer to my proxy? Because at the moment run() is called the proxy flag is false but the checkbox is true.

Thanks in advance!!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment