Announcement

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

    Grouped columns display problem

    Dear Support,
    We have the following problem with list grids when grouping is enabled.

    Please have a look on the following very simple code:

    Code:
    DataSource.load(new String[] {DSOperator.DS_NAME, DSBusinessUnit.DS_NAME} , new Function() {
    			
    			@Override
    			public void execute() {
    				ListGrid grid = new ListGrid(DataSource.get(DSOperator.DS_NAME));
    				grid.setAutoFetchData(true);
    				grid.setFields(new ListGridField(DSOperator.BUNIT_ID, "Business Unit"), new ListGridField(DSOperator.NAME, "Name"));
    				grid.getField(DSOperator.BUNIT_ID).setOptionDataSource(DataSource.get(DSBusinessUnit.DS_NAME));
    				grid.getField(DSOperator.BUNIT_ID).setValueField(DSOperator.ID);
    				grid.getField(DSOperator.BUNIT_ID).setDisplayField(DSOperator.NAME);
    				
    				VLayout test = new VLayout();
    				test.setWidth(600);
    				test.setHeight(400);
    				test.addMember(grid);
    				test.draw();
    			}
    		}, true);
    The problem: it seems that the optiondatasource column value mapping is not invoked when grouping on the first column... so the grouped value shows the ID instead of the corresponding display value... which is not the expected behaviour.

    Note that the problem is exactly the same if we set a value formatter on the column... which will not be called to display the group value:

    Code:
    DataSource.load(new String[] {DSOperator.DS_NAME, DSBusinessUnit.DS_NAME} , new Function() {
    			
    			@Override
    			public void execute() {
    				ListGrid grid = new ListGrid(DataSource.get(DSOperator.DS_NAME));
    				grid.setAutoFetchData(true);
    				grid.setFields(new ListGridField(DSOperator.BUNIT_ID, "Business Unit"), new ListGridField(DSOperator.NAME, "Name"));
    				grid.getField(DSOperator.BUNIT_ID).setCellFormatter(new CellFormatter() {
    					
    					@Override
    					public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
    						return "TEST" + value.toString();
    					}
    				});
    				
    				VLayout test = new VLayout();
    				test.setWidth(600);
    				test.setHeight(400);
    				test.addMember(grid);
    				test.draw();
    			}
    		}, true);
    In both cases, the ID is displayed.

    Thanks,

    Thomas

    #2
    You can use the groupTitleRenderer to provide custom rendering for a group node. This differs from the cell formatter as the group node isn't rendered inside a single column by default - it's a separate rendering which spans the entire row and includes the open/close icon.

    However it does seem like it may be appropriate to show the displayValue from the option-data-source for group header nodes - we'll investigate this.

    Regards
    Isomorphic Software

    Comment


      #3
      Hi,

      Any update about your investigations?
      Many thanks,

      Thomas

      Comment


        #4
        We've made this change in mainline (the 5.0d branch) already.
        We aren't planning to port this back to 4.1p, so if you're not running 5.0, you'll still need to use the groupTitleRenderer to achieve this until you are ready to upgrade to 5.0

        Regards
        Isomorphic Software

        Comment

        Working...
        X