Announcement

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

    In Listgrid : Problem with sorting a datefield (european format)

    I'm using SMARTGWT 3.0 build 11 September 2012.
    In my listgrid, i have a dateField.
    I get listgrid's data by rpc call. In my server side, the format of dateField is dd/mm/yyyy. So in my client side i want to set format "toEuropeanShortDate". But nothing is working.
    I tried :
    1)
    myGrid.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
    myGrid.setDateInputFormat("DMY");
    --> Not working
    2)
    DataSourceDateField dateField = new DataSourceDateField("date", "Date");
    dateField.setAttribute("inputFormat", "DMY");
    dateField.setAttribute("displayFormat", "toEuropeanShortDate");
    --> Not working
    3)
    DateUtil.setDateInputFormat("DMY");
    DateUtil.setShortDateDisplayFormat(DateDisplayFormat.TOEUROPEANSHORTDATE);
    --> Not working

    i have always the same result, when i sort my datefield, the results are sorted as if they are in the format mm/dd/yyyy.
    You can see the result of Ascending Sort in the picture attached.

    Please help.
    Thanks.
    Attached Files

    #2
    Formatting does not affect sort order.

    The problem is most likely that you are delivering the date as a String. You need to deliver it as a true Date (java.util.Date or subclass).

    Then sorting will work, and formatting will actually be applied (date formatters are not applied to String data).

    Comment


      #3
      You are right. In the server side, i deliver my dates as String.
      I just modified this as you said and everything works fine.

      Thanks a lot for your reply!!

      Comment

      Working...
      X