ishak1981
12 Dec 2010, 6:15 AM
Hello everybody
i habe a problem with the store of toListField. After i added a StoreListener to the store of toListField , the item is still visible in the toListField, when i drag and drop this item from toListField to fromListField. I want to access to the Models in the Listener. The code from EntryPoint:
FormPanel panel = new FormPanel();
panel.setFrame(true);
panel.setHeading("DualListField Example");
TextField<String> name = new TextField<String>();
name.setFieldLabel("Name");
panel.add(name, new FormData("98%"));
final DualListField<Stock> lists = new DualListField<Stock>();
lists.setMode(Mode.INSERT);
lists.setFieldLabel("ModelDatas");
ListField<Stock> from = lists.getFromList();
from.setDisplayField("name");
ListStore<Stock> store = new ListStore<Stock>();
store.add(TestData.getShortStocks());
from.setStore(store);
ListField<Stock> to = lists.getToList();
to.setDisplayField("name");
store = new ListStore<Stock>();
to.setStore(store);
panel.add(lists, new FormData("98%"));
TextField<String> email = new TextField<String>();
email.setFieldLabel("Email");
panel.add(email, new FormData("98%"));
panel.addButton(new Button("Cancel"));
panel.addButton(new Button("Save"));
panel.setWidth(550);
store.addStoreListener(new StoreListener<Stock>(){
@Override
public void handleEvent(StoreEvent<Stock> e) {
// TODO Auto-generated method stub
super.handleEvent(e);
Info.display("Name",e.getStore().getModels().get(0).get("name").toString());
}
});
RootPanel.get().add(panel);
i habe a problem with the store of toListField. After i added a StoreListener to the store of toListField , the item is still visible in the toListField, when i drag and drop this item from toListField to fromListField. I want to access to the Models in the Listener. The code from EntryPoint:
FormPanel panel = new FormPanel();
panel.setFrame(true);
panel.setHeading("DualListField Example");
TextField<String> name = new TextField<String>();
name.setFieldLabel("Name");
panel.add(name, new FormData("98%"));
final DualListField<Stock> lists = new DualListField<Stock>();
lists.setMode(Mode.INSERT);
lists.setFieldLabel("ModelDatas");
ListField<Stock> from = lists.getFromList();
from.setDisplayField("name");
ListStore<Stock> store = new ListStore<Stock>();
store.add(TestData.getShortStocks());
from.setStore(store);
ListField<Stock> to = lists.getToList();
to.setDisplayField("name");
store = new ListStore<Stock>();
to.setStore(store);
panel.add(lists, new FormData("98%"));
TextField<String> email = new TextField<String>();
email.setFieldLabel("Email");
panel.add(email, new FormData("98%"));
panel.addButton(new Button("Cancel"));
panel.addButton(new Button("Save"));
panel.setWidth(550);
store.addStoreListener(new StoreListener<Stock>(){
@Override
public void handleEvent(StoreEvent<Stock> e) {
// TODO Auto-generated method stub
super.handleEvent(e);
Info.display("Name",e.getStore().getModels().get(0).get("name").toString());
}
});
RootPanel.get().add(panel);