Hi again,
Our new problem: In SelectItem infinitive fetchData loop is triggered if sortField is specified.
If you run below code:
1. Select anything in “selectItem” and “selectItem2” will fetch data and set value for the first item
2. Open dropdown on “selectItem2” and check with SmartClient Dev Console and you will see looping fetch requests
FYI: The code was written this way in the past because business requirement was not possible to satisfy with setDefaultToFirstOption(true);
Issue reproduced with versions:
smartgwt-3.1p.2013-04-24
smartgwt-3.1p.2013-04-20
smartgwt-3.1p.2013-04-12
No issue with version:
smartgwt-3.1p.2013-01-24
Tested and reproduced with browser: FF 20.0.1
OS sytem: Win 7
Modified class ComboBoxStyledSample from the showcase:
Can you please fix this asap? It is blocking our release...
Thank you,
Fero
Our new problem: In SelectItem infinitive fetchData loop is triggered if sortField is specified.
If you run below code:
1. Select anything in “selectItem” and “selectItem2” will fetch data and set value for the first item
2. Open dropdown on “selectItem2” and check with SmartClient Dev Console and you will see looping fetch requests
FYI: The code was written this way in the past because business requirement was not possible to satisfy with setDefaultToFirstOption(true);
Issue reproduced with versions:
smartgwt-3.1p.2013-04-24
smartgwt-3.1p.2013-04-20
smartgwt-3.1p.2013-04-12
No issue with version:
smartgwt-3.1p.2013-01-24
Tested and reproduced with browser: FF 20.0.1
OS sytem: Win 7
Modified class ComboBoxStyledSample from the showcase:
Code:
public Canvas getViewPanel() { final DynamicForm form = new DynamicForm(); form.setWidth(500); final SelectItem selectItem = new SelectItem("selectItem"); final SelectItem selectItem2 = new SelectItem("selectItem2"); selectItem.setValueMap("Roll", "Ea", "Pkt", "Set", "Tube", "Pad", "Ream", "Tin", "Bag", "Ctn", "Box"); selectItem.addChangedHandler(new ChangedHandler() { public void onChanged(ChangedEvent event) { String selectedValue = (String) event.getValue(); Criteria criteria = new Criteria("units", "Roll"); selectItem2.setOptionCriteria(criteria); selectItem2.fetchData(new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { Record[] records = response.getData(); if (records.length > 0) { selectItem2.setValue(records[0].getAttribute("itemID")); } } }); } }); selectItem2.setOptionDataSource(ItemSupplyXmlDS.getInstance()); selectItem2.setValueField("itemID"); selectItem2.setDisplayField("itemName"); // if you comment out this line, it will change the behaviour selectItem2.setSortField("itemName"); selectItem2.setAutoFetchData(false); selectItem2.setAllowEmptyValue(false); form.setFields(selectItem, selectItem2); return form; }
Thank you,
Fero
Comment