Announcement

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

    Data missing when ListGrid grouping enabled

    Hi,
    I've found a possible bug in ListGrid ResultSet cache update when grouping is enabled. When editing data in connected to ListGrid DynamicFrom updates from fields that are not explicitly added to ListGrid are lost (not updated in current ListGrid cache). When grouping is disabled it works fine again. It does not matter if grouping is enabled by user or by code.

    Tested on SmartGWT 14.1p latest nightly (2025-06-26)

    I've used in this test case datasource WorldXmlDS from your showcase.

    Code:
    DataSource ds = WorldXmlDS.getInstance();
    
    VLayout layout = new VLayout();
    layout.setWidth100();
    
    DynamicForm form = new DynamicForm();
    form.setDataSource(ds);
    
    form.setFields(
    new TextItem("countryCode"),
    new TextItem("countryName"),
    new TextItem("continent"),
    new TextItem("capital"),
    new SubmitItem()
    );
    
    ListGrid listGrid = new ListGrid();
    listGrid.setWidth100();
    listGrid.setHeight(300);
    listGrid.setDataSource(ds);
    listGrid.setAutoFetchData(true);
    
    // listGrid.setCanPickOmittedFields(true);
    
    listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
    
    @Override
    public void onSelectionChanged(SelectionEvent event) {
    form.editSelectedData(listGrid);
    }
    });
    
    listGrid.setFields(
    new ListGridField("countryCode"),
    new ListGridField("countryName"),
    new ListGridField("continent")
    );
    // listGrid.setGroupByField("continent");
    
    layout.addMember(listGrid);
    layout.addMember(form);
    
    this.addChild(layout);
    Steps to reproduce:
    1. In above example enable grouping by continent.
    2. Select any record (ex US)
    3. Change data in fields countryCode and capital (ex add "2" at the end of these fields)
    4. Click submit
    5. Select any other record and get back to the first one (US)
    6. Data in countryCode is at was changed but capital is reverted.

    When you disable grouping and do it again capital will also be changed.
    Another workaround is to add all fields to ListGrid using
    Code:
    listGrid.setCanPickOmittedFields(true);
    Click image for larger version

Name:	2025-06-27_18-48.png
Views:	0
Size:	38.2 KB
ID:	275933

    Maybe when grouping is enabled ResultSet cache is updated differently -just a guess.

    Best regards
    Mariusz Goch
Working...
X