Announcement

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

    Bug in ListGrids setSortDirection?

    Hallo,

    at first a simple test case:

    Code:
    public class TestGrid extends Canvas {
    
    	protected void onInit() {
    		super.onInit();
    		ListGrid grid = new ListGrid();
    		ListGridField idField = new ListGridField("id");
    		grid.setFields(idField);
    		grid.setData(getTestData());
    		grid.setWidth100();
    		grid.setHeight100();
    		grid.setSortField(0);
    		grid.setSortDirection(SortDirection.DESCENDING);
    		this.addChild(grid);
    		this.setHeight100();
    	}
    	
    	
    	private Record[] getTestData() {
    		return new Record[] {
    				getRecord(3),
    				getRecord(2),
    				getRecord(4),
    				getRecord(1),
    				getRecord(5)
    		};
    	}
    	
    	private Record getRecord(int value) {
    		ListGridRecord record = new ListGridRecord();
    		record.setAttribute("id", value);
    		return record;
    	}
    }
    Indepent of the property in setSortDirection, the grid is always sorted ascending. Is this a bug or did I make a mistake some where?

    Christian


    PS: I'm using smartgwt 2.2.

    #2
    Can anybody confirm this problem?

    Comment


      #3
      I had the same Problem. Seems to be a bug.

      I fixed it like this:

      setAttribute("sortDirection", SortDirection.DESCENDING, true);

      (Which is nearly the same what "setSortDirection" does)

      Comment

      Working...
      X