Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    [SelectItem] Multiple values in Listgrid - Bug?

    Hello,

    I am trying to add a multiple selectItem in a listgrid where the user can edit and select multiple values from a valueMap: 2 values Europe and Asia (see pix attached: test_case0).

    If the user selects both values in the selectItem picklist and if she edits again the selectItem,, she has now the choice between Europe and Asia and Europe,Asia (see pix attached: test_case)
    I would have expected to have both values Europe and Asia selected but not this new third option...

    Test case:
    I derived the showcase code "edit by row" to provide you with a test case:

    OnModuleLoad:
    Code:
     
    	public static enum Result {EUROPE, ASIA};
    	 
    	public void onModuleLoad() {
    
    		DataSource worldDS = CountryXmlDS.getInstance();  
    		  
            final FilterBuilder filterBuilder = new FilterBuilder();  
            filterBuilder.setDataSource(worldDS);
      
            final ListGrid countryGrid = new ListGrid();  
            countryGrid.setWidth(550);  
            countryGrid.setHeight(224);  
            countryGrid.setDataSource(worldDS);  
            countryGrid.setAutoFetchData(true);  
            
            ListGridField continentField = new ListGridField("continent", "Continent");
            continentField.setCanFilter(true);
            continentField.setMultiple(true);
            
            countryGrid.setFields(continentField);  
      
            IButton filterButton = new IButton("Filter");  
            filterButton.addClickHandler(new ClickHandler() {  
                public void onClick(ClickEvent event) {  
                    countryGrid.filterData(filterBuilder.getCriteria());  
                }  
            });  
      
            VStack vStack = new VStack(10);  
            vStack.addMember(filterBuilder);  
            vStack.addMember(filterButton);  
            vStack.addMember(countryGrid);  
      
            vStack.draw();  
    	
    	}
    and the local datasource CountryXmlDS to run the test case:
    Code:
    public class CountryXmlDS extends DataSource {  
      
        private static CountryXmlDS instance = null;  
      
        public static CountryXmlDS getInstance() {  
            if (instance == null) {  
                instance = new CountryXmlDS("countryDS");  
            }  
            return instance;  
        }  
      
        public CountryXmlDS(String id) {  
      
            setID(id);  
            setRecordXPath("/List/country");  
            DataSourceIntegerField pkField = new DataSourceIntegerField("pk");  
            pkField.setHidden(true);  
            pkField.setPrimaryKey(true);  
      
            DataSourceTextField continentField = new DataSourceTextField("continent", "Continent");  
            HashMap<String, String> reportFormatMap = new HashMap<String, String>();
            for (Result reportFormatEnumVal: Result.values())
    			reportFormatMap.put(reportFormatEnumVal.name(),  reportFormatEnumVal.name());
            continentField.setValueMap(reportFormatMap);
            continentField.setMultiple(true);
            continentField.setCanEdit(true);
      
            setFields(pkField, continentField);  
      
            setDataURL("ds/test_data/country.data.xml");  
            setClientOnly(true);  
        }  
    }
    and finally a test record country.data.xml
    Code:
    <List>
    <country>
        <continent>Europe</continent>
    </country>
    </List>
    Any ideas?

    smartGWT 2.4
    Browser: Chrome
    Attached Files
Working...
X