Good day admin
I used createRecordComponent in list grid and put radio button into the component. Every time I compile the code, the list grid will remain normal but once I press to another tab and click back to the page that contain the list grid, the list grid will jump away and the radio button will disappear. To counter this, I add in a button that destroy the list grid and reconstruct it but the problem still remain.
I tested the code with latest smartgwt library 6.1p EE 29-12-2017, and run the code with Google chrome Version 63.0.3239.84 (Official Build) (64-bit), Internet Explorer version 11 ( 11.1106.10586.0) , Mozilla Firefox 43.0.4, Opera 49.0.2725 the problem still remain the same. I found out that the problem might be with the dynamicForm but I wasn't sure about it. Below is my sample code
fruitListGrid = new ListGrid(){
protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {
String fieldName = this.getFieldName(colNum);
DynamicForm form = new DynamicForm();
final Integer rowNum = this.getRecordIndex(record);
if (fieldName.equalsIgnoreCase("custom")) {
scoreColNum = colNum;
radioGroup = new RadioGroupItem("post_score_radio","");
//radioGroup.setID("post_score_radio_id");
radioGroup.setShowTitle(false);
radioGroup.setWidth(10);
LinkedHashMap<String, String> valueMap1 = new LinkedHashMap<String, String>();
valueMap1.put("1", "1");
LinkedHashMap<String, String> valueMap2 = new LinkedHashMap<String, String>();
valueMap2.put("1", "0");
int size = radioGroups.length;
radioGroups [size] = radioGroup;
if(rowNum % 2==0) {
radioGroup.setValueMap(valueMap1); //
} else {
radioGroup.setValueMap(valueMap2);//
}
radioGroup.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler(){
@Override
public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
if (rowNum % 2==0) {
radioGroups [rowNum + 1].setValue(false);
} else {
radioGroups [rowNum - 1].setValue(false);
}
//getScoreTotal ();
}
});
radioGroup.addChangedHandler(new com.smartgwt.client.widgets.form.fields.events.ChangedHandler () {
@Override
public void onChanged(com.smartgwt.client.widgets.form.fields.events.ChangedEvent event) {
}
});
form.setFields(radioGroup);
return form;
}
return form;
}
};
// WidgetFormatter.applyDefaultListGrid(fruitListGrid);
fruitListGrid.setFixedRecordHeights(false);
fruitListGrid.setShowRecordComponents(true);
fruitListGrid.setShowRecordComponentsByCell(true);
fruitListGrid.setGridComponents(new Object[] {
ListGridComponent.HEADER,
ListGridComponent.BODY,
});
fruitListGrid.setShowRowNumbers(false);
fruitListGrid.setAllowRowSpanning(true);
fruitListGrid.setData(FruitRecord.getRecords());
fruitListGrid.fetchData();
fruitListGrid.setUseRowSpanStyling(false);
fruitListGrid.setCanEdit(false);
fruitListGrid.setHoverMoveWithMouse(false);
ListGridField fruitParameter = new ListGridField("fruit","Parameter");
fruitParameter.setWidth("20%");
ListGridField fruitColor = new ListGridField("colors","Sign");
fruitColor.setWidth("70%");
ListGridField customCB = new ListGridField("custom","");
customCB.setShowTitle(false);
customCB.setCanEdit(true);
fruitListGrid.setFields(fruitParameter , fruitColor , customCB);
this.addMembers(fruitListGrid);
I used createRecordComponent in list grid and put radio button into the component. Every time I compile the code, the list grid will remain normal but once I press to another tab and click back to the page that contain the list grid, the list grid will jump away and the radio button will disappear. To counter this, I add in a button that destroy the list grid and reconstruct it but the problem still remain.
I tested the code with latest smartgwt library 6.1p EE 29-12-2017, and run the code with Google chrome Version 63.0.3239.84 (Official Build) (64-bit), Internet Explorer version 11 ( 11.1106.10586.0) , Mozilla Firefox 43.0.4, Opera 49.0.2725 the problem still remain the same. I found out that the problem might be with the dynamicForm but I wasn't sure about it. Below is my sample code
fruitListGrid = new ListGrid(){
protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {
String fieldName = this.getFieldName(colNum);
DynamicForm form = new DynamicForm();
final Integer rowNum = this.getRecordIndex(record);
if (fieldName.equalsIgnoreCase("custom")) {
scoreColNum = colNum;
radioGroup = new RadioGroupItem("post_score_radio","");
//radioGroup.setID("post_score_radio_id");
radioGroup.setShowTitle(false);
radioGroup.setWidth(10);
LinkedHashMap<String, String> valueMap1 = new LinkedHashMap<String, String>();
valueMap1.put("1", "1");
LinkedHashMap<String, String> valueMap2 = new LinkedHashMap<String, String>();
valueMap2.put("1", "0");
int size = radioGroups.length;
radioGroups [size] = radioGroup;
if(rowNum % 2==0) {
radioGroup.setValueMap(valueMap1); //
} else {
radioGroup.setValueMap(valueMap2);//
}
radioGroup.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler(){
@Override
public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
if (rowNum % 2==0) {
radioGroups [rowNum + 1].setValue(false);
} else {
radioGroups [rowNum - 1].setValue(false);
}
//getScoreTotal ();
}
});
radioGroup.addChangedHandler(new com.smartgwt.client.widgets.form.fields.events.ChangedHandler () {
@Override
public void onChanged(com.smartgwt.client.widgets.form.fields.events.ChangedEvent event) {
}
});
form.setFields(radioGroup);
return form;
}
return form;
}
};
// WidgetFormatter.applyDefaultListGrid(fruitListGrid);
fruitListGrid.setFixedRecordHeights(false);
fruitListGrid.setShowRecordComponents(true);
fruitListGrid.setShowRecordComponentsByCell(true);
fruitListGrid.setGridComponents(new Object[] {
ListGridComponent.HEADER,
ListGridComponent.BODY,
});
fruitListGrid.setShowRowNumbers(false);
fruitListGrid.setAllowRowSpanning(true);
fruitListGrid.setData(FruitRecord.getRecords());
fruitListGrid.fetchData();
fruitListGrid.setUseRowSpanStyling(false);
fruitListGrid.setCanEdit(false);
fruitListGrid.setHoverMoveWithMouse(false);
ListGridField fruitParameter = new ListGridField("fruit","Parameter");
fruitParameter.setWidth("20%");
ListGridField fruitColor = new ListGridField("colors","Sign");
fruitColor.setWidth("70%");
ListGridField customCB = new ListGridField("custom","");
customCB.setShowTitle(false);
customCB.setCanEdit(true);
fruitListGrid.setFields(fruitParameter , fruitColor , customCB);
this.addMembers(fruitListGrid);
Comment