Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: GXT 1.2.3 : Sort Dates in Grid

  1. #1

    Default GXT 1.2.3 : Sort Dates in Grid

    In a Grid, I have a column "Date", and when I want to sort this column, the dates sort correctly in host mode but do not sort correctly with Firefox or IE.


    It was OK with version 1.1.1 but not with 1.2.3.

  2. #2
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744

    Default

    for me work fine

    look http://www.extjs.com/explorer/#editablegrid

    post the code example

  3. #3

    Default

    Code:
    public class NewTabItem extends TabItem {
    
        private GroupingStore<BaseModel> gridStore;
    
        public NewTabItem (List<BaseModel> dates) {
            super();
    
            List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
            ColumnConfig date = new ColumnConfig("Date", "Released", 80);
            date.setDateTimeFormat(DateTimeFormat.getFormat("MMMM dd, yyyy"));
            columns.add(date);
    
            final ColumnModel cm = new ColumnModel(columns);
    
            final GroupingView view = new GroupingView();
            view.setForceFit(true);
            view.setGroupRenderer(new GridGroupRenderer() {
                public String render(GroupColumnData data) {
                    String l = data.models.size() == 1 ? "Item" : "Items";
                    return data.group + " (" + data.models.size() + " " + l + ")";
                }
            });
    
            gridStore = new GroupingStore<BaseModel>();
            gridStore.add(dates);
    
            Grid grid = new Grid<BaseModel>(gridStore, cm);
            grid.setLoadMask(true);
            grid.setBorders(true);
            grid.setView(view);
    
            setLayout(new FitLayout());
            setStyleAttribute("margin", "8px 0 0 0");
            add(grid);
        }
    
    }
    work fine in host mode, but not in firefox or IE.
    see image : (Dates are sorted in DESC...)

  4. #4
    Ext User fother's Avatar
    Join Date
    Sep 2007
    Location
    Brazil
    Posts
    744

  5. #5

    Default

    Sorry, it's DateTimeFormat.getFormat("MMMM dd, yyyy"); in my code
    but it's not the problem. The result is the same.

  6. #6

    Default

    Same problem for me.
    Have a column configuration with DateTimeFormat specified.
    Grid sorts it as a string rather than a date

  7. #7

    Default

    it's not the problem

  8. #8

    Default

    GXT 1.1.1 :
    - Host mode : OK
    - IE : OK
    - Firefox : OK

    GXT 1.2.3 :
    - Host mode : OK
    - IE : ERROR
    - Firefox : ERROR

    With the same code for 1.1.1 and 1.2.3



    WHY ?

  9. #9

    Default Same in 2.0.1

    I am having the same issue in GXT 2.0.1. Did you ever get this resolved?

  10. #10

    Default Figured It Out

    Looks like a GWT bug

    http://code.google.com/p/google-web-...00&q=compareto

    Basic issue is that the compareTo method in java.sql.Timestamp is broken. If you are returning Timestamp objects from the backend you will run into this issue.

    We wound up creating our own local copy of the emulated Timestamp class and changing the compareTo method to

    Code:
      
      public int compareTo(Timestamp o) {
        /*
        int delta = (int) (getTime() - o.getTime());
        return delta == 0 ? getNanos() - o.getNanos() : delta;
        */
        int i = super.compareTo(o);
        if (i == 0) {
          if (getNanos() > o.getNanos()) {
            return 1;
          } else if (getNanos() < o.getNanos()) {
            return -1;
          }
        }
        return i;
      }

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •