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:


Thanks.
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.
Comment