Announcement

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

    Listgrid grouping on date field bug when set firstDayOfWeek(1)

    ​I've come across the issues when grouping date field on ListGrid for option "By day of specific week".
    When I set firstDayOfWeek is Sunday (0) then its works fine but
    when I set firstDayOfWeek is Saturday (1) then its causing issues, It's showing wrong day name on title grouping title.


    Test case:
    Suppose I set date "04-AUG-2024". [Sunday]
    1. It's show Sunday on grouping title which is correct when I set firstDayOfWeek(0).
    2. It's show Saturday on grouping title which is in-correct when I set firstDayOfWeek(1).

    I am using Smart GWT 13.0 LGPL Edition

    Here is a sample code:

    Code:
    import java.util.Date;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.Record;
    import com.smartgwt.client.data.fields.DataSourceDateField;
    import com.smartgwt.client.data.fields.DataSourceIntegerField;
    import com.smartgwt.client.util.DateUtil;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class Test implements EntryPoint {
    
        private VLayout vlayout = new VLayout();
        private ListGrid listGrid = new ListGrid();
    
    
        public void onModuleLoad() {
    
            DateUtil.setFirstDayOfWeek(1);
            vlayout.setWidth(600);
            vlayout.setHeight(500);
    
            listGrid.setDataSource(ContentDS.getInstance());
            listGrid.setAutoFetchData(true);
    
             ListGridField cntn_week = new ListGridField("cntn_week");
             cntn_week.setWidth(100);
             ListGridField cntn_date = new ListGridField("cntn_date");
             cntn_date.setWidth(200);
    
             System.out.println(cntn_date.getGroupingMode());
             listGrid.setFields(cntn_week,cntn_date);
    
            vlayout.addMember(listGrid);
            vlayout.draw();
        }
    }
    
    class ContentDS extends DataSource {
    
        private static ContentDS instance = null;
    
        public static ContentDS getInstance() {
            if (instance == null) {
                instance = new ContentDS("contentDS");
            }
            return instance;
        }
    
        private ContentDS(String id) {
            setID(id);
            setClientOnly(true);
    
            DataSourceIntegerField pkField = new DataSourceIntegerField("cntn_pk");
            pkField.setHidden(true);
            pkField.setPrimaryKey(true);
    
            DataSourceIntegerField weekField = new DataSourceIntegerField("cntn_week");
    
            DataSourceDateField dateField = new DataSourceDateField("cntn_date");
    
            setFields(pkField, weekField, dateField);
    
            setTestData(
                    new ContentRecord(1, 31, new Date(2024-1900, 7, 04)),
                    new ContentRecord(2, 31, new Date(2024-1900, 7, 04)),
                    new ContentRecord(3, 32, new Date(2024-1900, 7, 06)),
                    new ContentRecord(4, 32, new Date(2024-1900, 7, 07)),
                    new ContentRecord(5, 32, new Date(2024-1900, 7, 10)),
                    new ContentRecord(6, 32, new Date(2024-1900, 7, 11)),
                    new ContentRecord(7, 33, new Date(2024-1900, 7, 12)));
        }
    
        private class ContentRecord extends Record {
            public ContentRecord(Integer pk, Integer week, Date date) {
                setAttribute("cntn_pk", pk);
                setAttribute("cntn_week", week);
                setAttribute("cntn_date", date);
            }
        }
    }



    Thanks.​

    #2
    Thanks for the report - you should find both the correct day-names and the correct week-numbers in all cases with today's builds of 13.x, dated August 23.

    Comment


      #3
      Hi,
      Thank you for your reply,

      Unfortunately, after updating jar files when I tried "By day of specific week" with same example it stops working and throw a JavaScript error.

      Attached a screenshot or error I faced.

      Thank you
      Attached Files

      Comment


        #4
        Thanks for the update - we've made a change to address this issue for tomorrow's builds, dated August 30 and later.

        Can you confirm which browser and version you saw this in? It seems like this issue you could only happen in Internet Explorer, or very old versions of some other browsers.

        Comment


          #5
          Oh, I’m sorry for the confusion. I was testing it in an old version of Firefox (version 24) because of the GWT plugin support, using GWT Legacy Development mode with Jetty. That's where I encountered the issue. However, it works perfectly fine in Super Dev Mode with the latest browsers.

          Thank you

          Comment

          Working...
          X