Table Component .setDatasource() method

After upgrading to Cuba ‘platform-6.5.4’ I started receiving this message when trying to populate a Table. This code was working in ‘platform-6.4.x’.

Error:
“Caused by: java.lang.UnsupportedOperationException: Changing datasource is not supported by the Table component”

Any ideas???

Sample Code:


private void populateTable(Map extras) {
    extrasList.addAll(extrasDs.getItems());
    extrasDs.clear();
    extras.forEach((v,k)->{
        Extras extra = new Extras();
        extra.setName(v.toString());
        extra.setDescription(v.toString());
        extra.setActive(false);
        BigDecimal amt = new BigDecimal((Double)k);
        extra.setAmount(amt);
        extrasDs.addItem(extra);
    });
    extrasTable.setDatasource(extrasDs);
}

Hi,

Unfortunately, in the previous versions there are hidden errors and memory leaks related to incorrect mechanism of changing datasource of Table and Tree. We have decided to prevent datasource changing since it actually is not supported by the component. We have fixed all the problems with datasource changing and enabled this in the upcoming Release 6.6: https://youtrack.cuba-platform.com/issue/PL-9133

Currently, you can simply clear and populate datasource (using includeItem / addItem methods) that is already set for a Table or create a Table programmatically each time you want to completely change its datasource.