Hi Isomorphic,
I have a problem that started to happen after the release of v12.0p_2019-10-30/PowerEdition Deployment (built 2019-10-30) - it's not happening in 2019-10-29!.
Button is not recreated after update. Method "updateRecordComponent" is not called at all.
Unfortunately I was unable to reproduce this problem in built-in-ds.
But my code looks like:
Bug doesn't appear in two cases:
-If I remove "setGroupValueFunction"
-If button is visible to all records
I hope you have enough information to detect the problem.
Best regards
Pavo
I have a problem that started to happen after the release of v12.0p_2019-10-30/PowerEdition Deployment (built 2019-10-30) - it's not happening in 2019-10-29!.
Button is not recreated after update. Method "updateRecordComponent" is not called at all.
Unfortunately I was unable to reproduce this problem in built-in-ds.
But my code looks like:
Code:
package com.smartgwt.sample.client; import com.smartgwt.client.types.GroupStartOpen; import com.smartgwt.client.types.RecordComponentPoolingMode; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.grid.GroupValueFunction; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.client.widgets.grid.events.RecordDoubleClickEvent; import com.smartgwt.client.widgets.grid.events.RecordDoubleClickHandler; public class ListGridCustom extends ListGrid { private String buttonField; private String categoryGroupByField = "category"; public ListGridCustom() { setDataSource("supplyItem"); setShowRecordComponents(true); setShowRecordComponentsByCell(true); setRecordComponentPoolingMode(RecordComponentPoolingMode.RECYCLE); setPoolComponentsPerColumn(true); setRecordComponentHeight(22); setCanGroupBy(false); setCanReorderFields(true); setGroupStartOpen(GroupStartOpen.ALL); setSortByGroupFirst(true); setAllowFilterExpressions(true); setGroupByField(categoryGroupByField); addRecordDoubleClickHandler(new RecordDoubleClickHandler() { @Override public void onRecordDoubleClick(RecordDoubleClickEvent event) { // Open window // Update datasource "yyyy". That update changes some values of "supplyItem" // Update response to datasource "yyyy" is returned and it contains related update to "supplyItem". } }); ListGridField itemNameLGF = new ListGridFieldGroupBy("itemName"); ListGridField categoryLGF = new ListGridFieldGroupBy(categoryGroupByField); // Many fields.... setFields(itemNameLGF, categoryLGF); } @Override protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) { // Many if-else conditions.... if (!WidgetUsed.canSeeButton(record)) return "gray"; else return super.getCellCSSText(record, rowNum, colNum); } @Override protected Canvas createRecordComponent(ListGridRecord record, Integer colNum) { return updateRecordComponent(record, colNum, null, true); } @Override public Canvas updateRecordComponent(ListGridRecord record, Integer colNum, Canvas component, boolean recordChanged) { if (record.getIsGroupSummary()) return null; String fieldName = this.getFieldName(colNum); if (buttonField.equals(fieldName) && WidgetUsed.canSeeButton(record)) { return new IButton();// ...... } // TODO Auto-generated method stub return super.updateRecordComponent(record, colNum, component, recordChanged); } private class ListGridFieldGroupBy extends ListGridField { public ListGridFieldGroupBy(String name) { super(name); setGroupValueFunction(new GroupValueFunction() { @Override public Object getGroupValue(Object value, ListGridRecord record, ListGridField field, String fieldName, ListGrid grid) { // Many if-else conditions... return null; } }); } } } class WidgetUsed { public static boolean canSeeButton(ListGridRecord r) { // If-else... return true; } }
-If I remove "setGroupValueFunction"
-If button is visible to all records
I hope you have enough information to detect the problem.
Best regards
Pavo
Comment