Hi all,
I've a little bug I caanot solve with the MiniDateRangeItem form component.
In the showcase, it's usage seems very simple, but when I integrate it in my application, I've some problems with it.
Here is my declaration:
final MiniDateRangeItem departureDateItem = new MiniDateRangeItem("mdri", "Departure date");
departureDateItem.setRequired(true);
By default, the field is disabled (is that normal?). To enable it, I added the following line:
departureDateItem.setDisabled(false);
I tough all my problems were fixed, but in facts, not. I can select a date range, but when I modify the value of a combobox manually with a myCombo.setValueMap(..); my MiniDateRangeItem is simply reset!
And when I submit the form, I get a NullPointerException when smartGWT tries to extract the value in the Item ... Any idea?
To give you more infos, here is the complete Form declaration:
Thanks for your help because this is really blocking me ...
I've a little bug I caanot solve with the MiniDateRangeItem form component.
In the showcase, it's usage seems very simple, but when I integrate it in my application, I've some problems with it.
Here is my declaration:
final MiniDateRangeItem departureDateItem = new MiniDateRangeItem("mdri", "Departure date");
departureDateItem.setRequired(true);
By default, the field is disabled (is that normal?). To enable it, I added the following line:
departureDateItem.setDisabled(false);
I tough all my problems were fixed, but in facts, not. I can select a date range, but when I modify the value of a combobox manually with a myCombo.setValueMap(..); my MiniDateRangeItem is simply reset!
And when I submit the form, I get a NullPointerException when smartGWT tries to extract the value in the Item ... Any idea?
To give you more infos, here is the complete Form declaration:
Code:
final HLayout formLayout = new HLayout(2);
final DynamicForm formSearchLoadingUnit = new DynamicForm();
formSearchLoadingUnit.setWidth("500px");
final TextItem inputLoadingUnit = new TextItem();
inputLoadingUnit.setRequired(true);
inputLoadingUnit.setTitle("Loading unit");
final MiniDateRangeItem departureDateItem = new MiniDateRangeItem("mdri", "Departure date");
departureDateItem.setRequired(true);
departureDateItem.setDisabled(false);
final ComboBoxItem departureTerminalCombo = new ComboBoxItem();
departureTerminalCombo.setTitle("Departure Terminal");
departureTerminalCombo.setType("comboBox");
departureTerminalCombo.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(KeyUpEvent event) {
String c = (String) departureTerminalCombo.getValue();
departureTerminalCombo.setHint("Please wait...");
terminalService.getTerminalsWithCriteria(c, new AsyncCallback<LinkedHashMap<String,String>>() {
@Override
public void onFailure(Throwable arg0) {
departureTerminalCombo.setHint("");
SC.warn("Unable to fetch terminals");
}
@Override
public void onSuccess(LinkedHashMap<String, String> valueMap) {
departureTerminalCombo.setHint("");
departureTerminalCombo.setValueMap(valueMap);
}
});
}
});
final ComboBoxItem destinationTerminalCombo = new ComboBoxItem();
destinationTerminalCombo.setTitle("Destination Terminal");
destinationTerminalCombo.setType("comboBox");
destinationTerminalCombo.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(KeyUpEvent event) {
String c = (String) destinationTerminalCombo.getValue();
destinationTerminalCombo.setHint("Please wait...");
terminalService.getTerminalsWithCriteria(c, new AsyncCallback<LinkedHashMap<String,String>>() {
@Override
public void onFailure(Throwable arg0) {
destinationTerminalCombo.setHint("");
SC.warn("Unable to fetch terminals");
}
@Override
public void onSuccess(LinkedHashMap<String, String> valueMap) {
destinationTerminalCombo.setHint("");
destinationTerminalCombo.setValueMap(valueMap);
}
});
}
});
final RadioGroupItem showActive = new RadioGroupItem();
showActive.setVertical(false);
showActive.setTitle("Show active transports only");
LinkedHashMap<String, String> yesNo = new LinkedHashMap<String, String>();
yesNo.put("1", "Yes");
yesNo.put("0", "No");
showActive.setValueMap(yesNo);
showActive.setDefaultValue("0");
formSearchLoadingUnit.setFields(inputLoadingUnit,departureDateItem,departureTerminalCombo,destinationTerminalCombo,showActive);
formSearchLoadingUnit.setTitleWidth(175);
final Button searchItu = new Button("Search");
searchItu.setStyleName("searchButton");
formLayout.addMember(formSearchLoadingUnit);
formLayout.addMember(searchItu);
Comment