我有一個在com.smartgwt.client.widgets.Window.Window()中打開的搜索表單。在這裏面,我有一個VLayout,其中我有一個搜索表單:SmartGWT TextItem - focusInItem()方法不工作?
DynamicForm search = new DynamicForm();
// setMargin, setTitle, setNumCols
TextItem name = new TextItem();
name.setFormatOnFocusChange(true);
//setEditorValueFormatter, etc.
search.setFields(/*some fields*/, name, /*other fields*/);
name.focusInItem();
和重點是不是在項目(這是無處)。爲什麼?
預先感謝您!
編輯:
這裏是兩個調解員代碼:
public class MainMediator extends Mediator {
private Window popup = new Window();
protected void initView(){
// here I have a Form with fields and icon on one TextItem, on which I do:
searchField.addIconClickHandler(new IconClickHandler() {
popup = new Window();
popup.setIsModal(true);
popup.setShowModalMask(true);
});
}
public final void handleNotification(final INotification notification){
// if the right notification is sent, execute this code:
PopupMediator m = (PopupMediator) this.getFacade().retreiveMediator(PopupMediator.NAME);
VLayout popupLayout = (VLayout) m.getViewComponent();
popup.addItem(popupLayout);
popup.show();
}
}
public class PopupMediator extends Mediator {
protected void initView(){
viewComponent = new VLayout();
DynamicForm searchForm = new DynamicForm();
// searchForm props
TextItem name = new TextItem();
// name props and some other fields
searchForm.setFields(name /* and the others */);
VLayout searchFormContainer = new VLayout();
// searchFormContainer props
searchFormContainer.setMembers(seachForm);
name.focusInItem(); // not working on popup shown
HLayout searchContainer = new HLayout();
// searchContainer props
searchContainer.setMembers(grid1, searchFormContainer);
VLayout container = new VLayout();
// container props
container.setMembers (searchContainer, grid2);
((VLayout)viewComponent).setMembers(container, buttons);
}
它不工作:( – Bubolina