Bugs
12-08-2008, 01:55 PM
I am trying to load a very simple Car domain object (id +name) into a ComboBox, but so far failing.
I have the following service:
@RemoteServiceRelativePath("exampleService")
public interface ExampleService extends RemoteService {
List<Car> getCars();
}
ExampleServiceAsync:
public interface ExampleServiceAsync {
void getCars(AsyncCallback<List<Car>> cars);
}
The ExampleServiceImpl read the Cars from the database.
I then try the following:
final ExampleServiceAsync service = Registry.get("exampleService");
final List<Car> cars = new ArrayList<Car>();
service.getCars(new AsyncCallback<List<Car>>() {
public void onFailure(Throwable caught) {
//
}
public void onSuccess(List<Car> result) {
cars.addAll(result);
}
});
ListStore<Car> store = new ListStore<Car>();
store.add(cars);
ComboBox<Car> combo = new ComboBox<Car>();
combo.setFieldLabel("Car names");
combo.setDisplayField("name");
combo.setStore(store);
The items are correctly retrieved from the database, but I am not so sure if this is the correct way to load the items.
:-?
I have the following service:
@RemoteServiceRelativePath("exampleService")
public interface ExampleService extends RemoteService {
List<Car> getCars();
}
ExampleServiceAsync:
public interface ExampleServiceAsync {
void getCars(AsyncCallback<List<Car>> cars);
}
The ExampleServiceImpl read the Cars from the database.
I then try the following:
final ExampleServiceAsync service = Registry.get("exampleService");
final List<Car> cars = new ArrayList<Car>();
service.getCars(new AsyncCallback<List<Car>>() {
public void onFailure(Throwable caught) {
//
}
public void onSuccess(List<Car> result) {
cars.addAll(result);
}
});
ListStore<Car> store = new ListStore<Car>();
store.add(cars);
ComboBox<Car> combo = new ComboBox<Car>();
combo.setFieldLabel("Car names");
combo.setDisplayField("name");
combo.setStore(store);
The items are correctly retrieved from the database, but I am not so sure if this is the correct way to load the items.
:-?