Hi, I'm migrating our application from SmartGWT 2.3 to 2.4, and testing has revealed that DataSourceField.setValueMap() has broken. This is seen when I use the DataSourceField in a custom client side datasource used by a FilterBuilder. I'm running Firefox 3.6.13 on Ubuntu 10.06.
I have created an example that uses the CustomDS sample that comes with the both 2.3 and 2.4. If you run the example code below in 2.3, the values set in setValueMap() are in the ComboBox. If you run it 2.4, they are not. It appears something has broken internally between the releases, but I'm not sure what.
Here is CustomDS.java:
And CustomFilterDataSource.java
I have created an example that uses the CustomDS sample that comes with the both 2.3 and 2.4. If you run the example code below in 2.3, the values set in setValueMap() are in the ComboBox. If you run it 2.4, they are not. It appears something has broken internally between the releases, but I'm not sure what.
Here is CustomDS.java:
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.util.KeyCallback; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.FilterBuilder; import com.smartgwt.client.widgets.layout.VStack; /** * Entry point classes define <code>onModuleLoad()</code>. */ public class CustomDS implements EntryPoint { /** * This is the entry point method. */ public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey( true ); debugKey.setKeyName( "D" ); Page.registerKey( debugKey, new KeyCallback() { public void execute(String keyName) { SC.showConsole(); } } ); VStack vStack = new VStack(); vStack.setLeft( 175 ); vStack.setTop( 75 ); vStack.setWidth( "70%" ); vStack.setMembersMargin( 20 ); Label label = new Label(); label.setContents( "<ul>" + "<li>The Combo Boxes for Field 1 and 2 should have values in their picklists</li>" + "</ul>" ); vStack.addMember( label ); DataSource ds = new CustomFilterDataSource(); FilterBuilder filterBuilder = new FilterBuilder(); filterBuilder.setDataSource( ds ); vStack.setMembers( label, filterBuilder ); vStack.draw(); } }
Code:
// Filename: NotamDataSource.java package com.smartgwt.sample.client; import java.util.TreeMap; public class CustomFilterDataSource extends DataSource { final DataSourceField field1; final DataSourceField field2; public CustomFilterDataSource() { setShowPrompt( false ); ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.setType( "comboBox" ); comboBoxItem.setWidth( 300 ); field1 = new DataSourceTextField( "field1", "Field 1", 50 ); field1.setEditorType( comboBoxItem ); field1.setValueMap( new String[ ] { "AA", "AB" } ); addField( field1 ); field2 = new DataSourceEnumField( "field2", "Field 2", 50 ); field2.setEditorType( comboBoxItem ); TreeMap<String, String> map = new TreeMap<String, String>(); map.put("v1", "value 1"); map.put("v2", "value 2"); field2.setValueMap( map ); addField( field2 ); setClientOnly( true ); } }
Comment