Announcement

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

    [BUG] PickList not retaining value after "filtered select"

    GWT version: 2.4.0
    Smart GWT version: 3.0 (smartgwt-3.0p)
    SmartClient Version: 8.2/LGPL Development Only (built 2011-12-05)
    Browser: Firefox 11.0
    Operating System: Windows 7 Ultimate
    GWT Development Mode

    Hello,

    When i create a PickList and set a ListGrid with a filter editor as its properties, any selections made with an active filter results in that selection becoming the new value (discarding previously selected records). If i remove the filter criteria after making this selection (showing all records) it seems the previously selected records are still selected, but this is not reflected by the PickList's value.

    For example, I have a PickList item with a "name" field that has 4 values: John, Eddy, Michael and Alex. John and Eddy are selected. When I enter the text "Al" in the filter editor for the "name" field, values are filtered so that only Alex is shown. If I select this value, the value of the PickList becomes Alex, discarding John and Eddy. If i remove the text "Al" in the filter editor, the entire list of values is shown again, and John, Eddy and Alex are selected, but the value of the PickList item is still set to Alex.

    Test case
    Code:
    package com.project.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.fields.DataSourceIntegerField;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.types.Autofit;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.SelectItem;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    
    public class Project implements EntryPoint {
    	private static class UserXmlDS extends DataSource {  
    		  
    	    private static UserXmlDS instance = null;  
    	  
    	    public static UserXmlDS getInstance() {  
    	        if (instance == null) {  
    	            instance = new UserXmlDS("userXmlDS");  
    	        }  
    	        return instance;  
    	    }  
    	  
    	    public UserXmlDS(String id) {  
    	  
    	        setID(id);  
    	        setRecordXPath("/List/user");  
    	        DataSourceIntegerField pkField = new DataSourceIntegerField("id", "ID");
    	        pkField.setPrimaryKey(true);  	  
    	        DataSourceTextField nameField = new DataSourceTextField("name", "Name"); 
    	        setFields(pkField, nameField);  	  
    	        setDataURL("test_data/user.data.xml");  
    	        setClientOnly(true);  
    	    }  
    	}   
        public void onModuleLoad() {   
    
        	UserXmlDS ds = UserXmlDS.getInstance();
    		ListGrid userSelectProperties = new ListGrid();
    		userSelectProperties.setShowFilterEditor(true);
    		userSelectProperties.setFilterOnKeypress(true);
    		ListGridField nameField = new ListGridField("name");		
    		
    		SelectItem userSelect = new SelectItem("users", "Users");
    		userSelect.setDisplayField("name");
    		userSelect.setValueField("id");
    		userSelect.setOptionDataSource(ds);		
    		userSelect.setFilterLocally(true);
    		userSelect.setMultiple(true);
    		userSelect.setPickListFields(nameField);
    		userSelect.setPickListProperties(userSelectProperties); 
    		
    		DynamicForm userForm = new DynamicForm();
    		userForm.setFields(userSelect);
    		userForm.draw();
        }
    }
    user.data.xml
    Code:
    <List>
    <user>
        <id>1</id>
        <name>John</name>
    </user>
    <user>
        <id>2</id>
        <name>Eddy</name>
    </user>
    <user>
        <id>3</id>
        <name>Michael</name>
    </user>
    <user>
        <id>4</id>
        <name>Alex</name>
    </user>
    </List>

    #2
    Thanks for the clear test case and details. This is a known issue that comes up with clientOnly DataSources only, so it won't affect your real application.

    Comment


      #3
      I only used the clientOnly XML datasource to make it easier for reproducing the bug in a single test case.
      In my real application, I use a DataSource which is not set to clientOnly, and the same problem occurs.

      Any ideas?

      Comment


        #4
        Hi there,

        to not open a new thread I revive this one. I'm facing the same issue. We're SmartClient Version: v9.0p_2013-07-14/LGPL Development Only (built 2013-07-14).

        My dataSource is not clientOnly. I've tried setting selectionProperty to the propertyListGrid passed to the SelectItem with multiple = true and handling the response the same (successfully working) way I have done in other modules of my project (but always in ListGrids). There's a way to maintain the selected items of the pickList through filtering the data?

        Thanks for your support

        Comment

        Working...
        X