Announcement

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

    Bug - ListGridField multiple values with OptionDataSource

    Using SC_SNAPSHOT-2011-01-06/EVAL Deployment 2011-01-06

    I have a ListGridField that takes multiple keys from another data source, using one field for display and one field for values (the values are the keys).

    When a single value is selected it works fine and shows the 'displayField' value. When multiple values are selected, it shows the keys instead.

    Seems like a bug to me. Glad to be wrong though.

    Here's a test case. Try selecting a single value. Then try multiple values.

    Code:
    		DataSource ds = new DataSource("optionDS");
    		ds.setClientOnly(true);
    		DataSourceField keyField = new DataSourceTextField("key");
    		keyField.setPrimaryKey(true);
    		DataSourceField valueField = new DataSourceTextField("value");
    		ds.addField(keyField);
    		ds.addField(valueField);
    
    		DataSource ds2 = new DataSource("mainDS");
    		ds2.setClientOnly(true);
    		DataSourceTextField key2 = new DataSourceTextField("key2");
    		key2.setPrimaryKey(true);
    		DataSourceTextField values = new DataSourceTextField("values");
    		values.setMultiple(true);
    		ds2.addField(key2);
    		ds2.addField(values);
    
    		for (int i = 0; i < 3; i++) {
    			Record optionRecord = new Record();
    			optionRecord.setAttribute(keyField.getName(), "someKey" + i);
    			optionRecord.setAttribute(valueField.getName(), "someValue" + i);
    			ds.addData(optionRecord);
    		}
    
    		ListGridField field = new ListGridField("values");
    		field.setMultiple(true);
    		field.setOptionDataSource(ds);
    		field.setValueField("key");
    		field.setDisplayField("value");
    		ListGrid grid = new ListGrid();
    		grid.setFields(field);
    		grid.setDataSource(ds2);
    		grid.setCanEdit(true);
    		grid.draw();
    		grid.startEditingNew();

    #2
    Any ideas?

    How come it works with one value selected, but not multiple ones?

    Comment


      #3
      This has been fixed. Please try the latest nightly.

      Comment


        #4
        Great. Thank you.

        Comment


          #5
          Small update. Using the latest build, the behavior is still inconsistent.

          It works perfectly if the displayField and valueField are set. If the displayField value is null, then it shows the valueField. I never want the user to see generated ID values. Also, it's inconsistent because the picklist shows them blank (which is the correct behaviour)

          Comment

          Working...
          X