Announcement

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

    Bug or Limitation? ListGrid.groupBy does not show displayField

    I am using the nightly build (3 days old) of SmartGWTEE.

    I wanted to use the groupBy feature of the ListGrid to group items by their type. My records contain a typeId, but I want to show the typeName. The example below shows the issue and I attach a screenshot.

    What I had hoped was that groupBy would use the displayField, but the group title ignores this. In the screenshot, I expected the group to be the typeName "Value" not "100".


    Code:
    		
    
                    DataSource ds = new DataSource();
    		ds.setID("ds");
    		DataSource ds2 = new DataSource();
    		ds2.setID("ds2");
    		{
    			DataSourceTextField keyField = new DataSourceTextField("key");
    			keyField.setPrimaryKey(true);
    			DataSourceTextField valueField = new DataSourceTextField("value");
    			ds2.addField(keyField);
    			ds2.addField(valueField);
    			ds2.setClientOnly(true);
    			Record testRecord = new ListGridRecord();
    			testRecord.setAttribute("key2", "100");
    			testRecord.setAttribute("value", "Value");
    			ds2.setTestData(new Record[] { testRecord });
    		}
    		{
    			DataSourceTextField keyField = new DataSourceTextField("key");
    			keyField.setPrimaryKey(true);
    			DataSourceTextField valueField = new DataSourceTextField("key2");
    			valueField.setForeignKey(ds.getID() + ".key2");
    			ds.addField(keyField);
    			ds.addField(valueField);
    			ds.setClientOnly(true);
    			Record testRecord = new ListGridRecord();
    			testRecord.setAttribute("key", "1");
    			testRecord.setAttribute("key2", "100");
    			ds.setTestData(new Record[] { testRecord });
    		}
    		ListGrid grid = new ListGrid();
    		grid.setDataSource(ds);
    		grid.setAutoFetchData(true);
    
    		ListGridField key2Field = new ListGridField("key2");
    		key2Field.setDisplayField("value");
    		key2Field.setOptionDataSource(ds2);
    		grid.setFields(new ListGridField("key"), key2Field);
    		grid.setGroupByField("key2");
    
    		setSize("100%", "100%");
    		addChild(grid);
    Attached Files

    #2
    Hello,

    I am also getting the same result, did you ever have any joy sorting it?

    I did mention it in a post http://forums.smartclient.com/showthread.php?t=12037 a while ago, but didn't get a response! (Maybe didn't explain myself very well)

    Kind Regards
    Jeni
    Last edited by jrich; 16 Jan 2011, 09:36.

    Comment

    Working...
    X