SmartGWT version: 2.3 Pro
Browser: Firefox (but appears to be non-browser specific, also occurs with Safari and IE).
I recently upgraded one of our existing applications from SmartGWT Pro 2.1 to SmartGWT Pro 2.3. This went pretty smoothly, except for one issues that appears to have cropped up. This was definitely working in 2.1 but no longer works in 2.3 - I'm not sure why.
I have a number of comboBoxItems that are databound and dependent selects (similar to the example for Databound Depedent Selects from the showcase). All of them have the same problem; but I'll use one specific example. I have 3 comboBoxItems: country, state and location. They are supposed to be dependent selects - picking a country is supposed to filter the state and location comboBoxItems, picking a state is supposed to filter the location comboBoxItem. In other words: if I select Country= United States and State = Georgia, I should only get locations that are in the US and in the state Georgia. Pretty straightforward. In addition, if the user starts typing in one of the dropdowns, it's supposed to "auto-complete" by limiting options, so if I type "Uni" in the Country dropdown, it's supposed to show countries that start with "Uni" - in this case, the United Kingdom and the United States.
I implemented this as follows:
Creation of dropdowns:
inner classes for dropdowns:
EventHandling:
In 2.1, this worked as expected. In 2.3; it only works the first time a selection is made, on subsequent selections the pickListCriteria don't seem to get updated, but instead it submits the criteria for the first selection.
What this means is this: I pick the state "Delaware", the location box updates and shows locations for Delaware. I now change the state to Florida, the server actually still gets asked for State=Delaware and the LocationBox still shows locations for Delaware.
I can see from server logs that the request IS being made from the RPCManager, but the value for state isn't being changed. No idea why.
Server log for first Delaware request:
Request for second "Floriday" request:
You can see that the id for state isn't changing.
Any idea why, guys?
Browser: Firefox (but appears to be non-browser specific, also occurs with Safari and IE).
I recently upgraded one of our existing applications from SmartGWT Pro 2.1 to SmartGWT Pro 2.3. This went pretty smoothly, except for one issues that appears to have cropped up. This was definitely working in 2.1 but no longer works in 2.3 - I'm not sure why.
I have a number of comboBoxItems that are databound and dependent selects (similar to the example for Databound Depedent Selects from the showcase). All of them have the same problem; but I'll use one specific example. I have 3 comboBoxItems: country, state and location. They are supposed to be dependent selects - picking a country is supposed to filter the state and location comboBoxItems, picking a state is supposed to filter the location comboBoxItem. In other words: if I select Country= United States and State = Georgia, I should only get locations that are in the US and in the state Georgia. Pretty straightforward. In addition, if the user starts typing in one of the dropdowns, it's supposed to "auto-complete" by limiting options, so if I type "Uni" in the Country dropdown, it's supposed to show countries that start with "Uni" - in this case, the United Kingdom and the United States.
I implemented this as follows:
Creation of dropdowns:
Code:
country = new CountryComboBoxItem(DIDField.COUNTRY.getName()); country.setTitle(DIDField.COUNTRY.getDisplayTitle()); country.setWidth(225); country.setValueField(CountryField.COUNTRY_ID.getName()); country.setDisplayField(CountryField.COUNTRY_NAME.getName()); country.setOptionDataSource(countryDS); ListGridField countryFlag = new ListGridField(CountryField.COUNTRY_CODE.getName(), "Flag", 30); countryFlag.setType(ListGridFieldType.IMAGE); countryFlag.setImageURLPrefix("flags/16/"); countryFlag.setImageURLSuffix(".png"); ListGridField countryName = new ListGridField(CountryField.COUNTRY_NAME.getName(), CountryField.COUNTRY_NAME.getDisplayTitle()); country.setPickListFields(countryFlag, countryName); state = new StateComboBoxItem(DIDField.STATE.getName()); state.setTitle(DIDField.STATE.getDisplayTitle()); state.setWidth(225); state.setValueField(StateField.STATE_ID.getName()); state.setDisplayField(StateField.STATE_NAME.getName()); state.setOptionDataSource(stateDS); ListGridField stateCountryFlag = new ListGridField(StateField.COUNTRY_CODE.getName(), "Flag", 30); stateCountryFlag.setType(ListGridFieldType.IMAGE); stateCountryFlag.setImageURLPrefix("flags/16/"); stateCountryFlag.setImageURLSuffix(".png"); ListGridField stateName = new ListGridField(StateField.STATE_NAME.getName(), StateField.STATE_NAME.getDisplayTitle()); state.setPickListFields(stateName, stateCountryFlag); location = new LocationComboBoxItem(DIDField.LOCATION.getName()); location.setTitle(DIDField.LOCATION.getDisplayTitle()); location.setWidth(225); location.setValueField(LocationField.LOCATION_ID.getName()); location.setDisplayField(LocationField.LOCATION_NAME.getName()); location.setOptionDataSource(locationDS); ListGridField locationCountryFlag = new ListGridField(LocationField.COUNTRY_CODE.getName(), "Flag", 30); ListGridField locationStateName = new ListGridField(LocationField.STATE_CODE.getName(), LocationField.STATE_CODE.getDisplayTitle(), 30); locationCountryFlag.setType(ListGridFieldType.IMAGE); locationCountryFlag.setImageURLPrefix("flags/16/"); locationCountryFlag.setImageURLSuffix(".png"); ListGridField locationName = new ListGridField(LocationField.LOCATION_NAME.getName(), LocationField.LOCATION_NAME.getDisplayTitle()); location.setPickListFields(locationName, locationStateName, locationCountryFlag);
Code:
public class CountryComboBoxItem extends IntComboBoxItem { public CountryComboBoxItem(String name) { super(name); } @Override public Criteria getPickListFilterCriteria() { Criteria criteria = new Criteria(); if(getValue()!= null && getValue() instanceof String) { criteria.addCriteria(CountryField.COUNTRY_NAME.getName(), (String)getValue()); } criteria.addCriteria(CountryField.FILTERED.getName(), true); return criteria; } } public class StateComboBoxItem extends IntComboBoxItem { public StateComboBoxItem(String name) { super(name); } @Override public Criteria getPickListFilterCriteria() { Criteria criteria = new Criteria(); if(country.getSelectedRecord() != null) { String countryId = country.getSelectedRecord().getAttribute(CountryField.COUNTRY_ID.getName()); criteria.addCriteria(DirectoryListingField.COUNTRY.getName(), countryId); } if(getValue()!= null && getValue() instanceof String) { criteria.addCriteria(StateField.STATE_NAME.getName(), (String)getValue()); } criteria.addCriteria(CountryField.FILTERED.getName(), true); return criteria; } } public class LocationComboBoxItem extends IntComboBoxItem { public LocationComboBoxItem(String name) { super(name); } @Override public Criteria getPickListFilterCriteria() { Criteria criteria = new Criteria(); if(country.getSelectedRecord() != null) { String countryId = country.getSelectedRecord().getAttribute(CountryField.COUNTRY_ID.getName()); criteria.addCriteria(DirectoryListingField.COUNTRY.getName(), countryId); } if(state.getSelectedRecord() != null) { String stateId = state.getSelectedRecord().getAttribute(StateField.STATE_ID.getName()); criteria.addCriteria(DirectoryListingField.STATE.getName(), stateId); } if(getValue()!= null && getValue() instanceof String) { criteria.addCriteria(LocationField.LOCATION_NAME.getName(), (String)getValue()); } criteria.addCriteria(CountryField.FILTERED.getName(), true); return criteria; } }
Code:
HandlerRegistration countryPickerAboutToChangeReg = country.addChangeHandler(new ChangeHandler(){ @Override public void onChange(ChangeEvent event) { state.clearValue(); location.clearValue(); } }); HandlerRegistration countryPickerReg = country.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { state.fetchData(); location.fetchData(); } }); HandlerRegistration statePickerChangeRegAboutToChangeReg = state.addChangeHandler(new ChangeHandler(){ @Override public void onChange(ChangeEvent event) { location.clearValue(); } }); HandlerRegistration statePickerReg = state.addChangedHandler(new ChangedHandler(){ @Override public void onChanged(ChangedEvent event) { location.fetchData(); } }); HandlerRegistration locationPickerReg = location.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { location.fetchData(); } });
What this means is this: I pick the state "Delaware", the location box updates and shows locations for Delaware. I now change the state to Florida, the server actually still gets asked for State=Delaware and the LocationBox still shows locations for Delaware.
I can see from server logs that the request IS being made from the RPCManager, but the value for state isn't being changed. No idea why.
Server log for first Delaware request:
14:52:56,936 DEBUG XML:406 - Parsed XML from (in memory stream): 1ms
14:52:56,938 DEBUG RPCManager:406 - Processing 1 requests.
14:52:56,938 DEBUG RPCManager:406 - Request #1 (DSRequest) payload: {
criteria:{
state:"22",
filtered:true
},
operationConfig:{
dataSource:"location",
operationType:"fetch",
textMatchStyle:"startsWith"
},
startRow:0,
endRow:75,
componentId:"isc_PickListMenu_1",
appID:"builtinApplication",
operation:"location_fetch",
oldValues:{
state:"22",
filtered:true
}
}
14:52:56,938 DEBUG RPCManager:406 - Processing 1 requests.
14:52:56,938 DEBUG RPCManager:406 - Request #1 (DSRequest) payload: {
criteria:{
state:"22",
filtered:true
},
operationConfig:{
dataSource:"location",
operationType:"fetch",
textMatchStyle:"startsWith"
},
startRow:0,
endRow:75,
componentId:"isc_PickListMenu_1",
appID:"builtinApplication",
operation:"location_fetch",
oldValues:{
state:"22",
filtered:true
}
}
14:53:32,376 DEBUG XML:406 - Parsed XML from (in memory stream): 1ms
14:53:32,379 DEBUG RPCManager:406 - Processing 1 requests.
14:53:32,379 DEBUG RPCManager:406 - Request #1 (DSRequest) payload: {
criteria:{
state:"22",
filtered:true
},
operationConfig:{
dataSource:"location",
operationType:"fetch",
textMatchStyle:"startsWith"
},
startRow:0,
endRow:75,
componentId:"isc_PickListMenu_1",
appID:"builtinApplication",
operation:"location_fetch",
oldValues:{
state:"22",
filtered:true
}
}
14:53:32,379 DEBUG RPCManager:406 - Processing 1 requests.
14:53:32,379 DEBUG RPCManager:406 - Request #1 (DSRequest) payload: {
criteria:{
state:"22",
filtered:true
},
operationConfig:{
dataSource:"location",
operationType:"fetch",
textMatchStyle:"startsWith"
},
startRow:0,
endRow:75,
componentId:"isc_PickListMenu_1",
appID:"builtinApplication",
operation:"location_fetch",
oldValues:{
state:"22",
filtered:true
}
}
Any idea why, guys?
Comment