Announcement

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

    Switching to Smartgwt 5.0 from 4.0 createRecordComponent issues

    SmartGWT 5.0,Browser Firefox 21.0

    Hello I have a problem with the createRecordComponent on smartgwt 5.0(on smartgwt 4 worked fine until i switch to 5),it doesn't redraw the others records images cell when it enters on value field editor.the value field editor is a TextAreaItem.There are no warning or error in console.
    It seems that the image has position absolute and doesn't depend on height cell anymore.Is there any listGrid property that actually solve this? Also I cant quit using setEditorCustomizer because i need for different cases(the code below is just a simple representation of what I want).Thanks in advance.

    Code:
     
    public class CustomListGrid extends ListGrid {
    
        @Override
        protected Canvas createRecordComponent(ListGridRecord record, Integer colNum) {
    	String fieldName = getFieldName(colNum);
    	if (fieldName.equals("actionsField")) {
    
    	    ImgButton editImg = new ImgButton();
    	    editImg.setSrc("edit.png");
    	    editImg.setShowDown(true);
    	    editImg.setShowRollOver(false);
    	    editImg.setRedrawOnResize(true);
    	    editImg.setLayoutAlign(Alignment.CENTER);
    	    editImg.setPrompt("edit");
    	    editImg.setHeight(16);
    	    editImg.setWidth(16);
    	    return editImg;
    	}
    	return super.createRecordComponent(record, colNum);
        }
    
        public CustomListGrid() {
    	setCanEdit(true);
    	setCanFocus(true);
    	setCanTabToHeader(true);
    	setWrapCells(true);
    	setCanExpandRecords(false);
    	setCanResizeFields(true);
    	setRedrawOnResize(true);
    	setShowRecordComponents(true);
    	setValidateByCell(true);
    	setShowRecordComponentsByCell(true);
    	setShowAllRecords(true);
    	setEditEvent(ListGridEditEvent.CLICK);
    	setAutoSaveEdits(true);
    	setEditByCell(true);
    	setOverflow(Overflow.VISIBLE);
    	setHeight(800);
    	setWidth(1000);
    
    	
    	setEditorCustomizer(new ListGridEditorCustomizer() {
    	    @Override
    	    public FormItem getEditor(ListGridEditorContext context) {
    		if (context.getEditField().getName().equals("value")) {
    		    TextAreaItem textAreaItem = new TextAreaItem();
    		    return textAreaItem;
    		}
    		return context.getDefaultProperties();
    	    }
    	});
    
    	ListGridField nameField = new ListGridField("name", "Name");
    	nameField.setWidth("28%");
    	nameField.setCanEdit(false);
    	nameField.setWrap(false);
    
    	ListGridField valueField = new ListGridField("value", "Value");
    	valueField.setWidth("55%");
    
    	ListGridField actionField = new ListGridField("actionsField", "Actions Field");
    	actionField.setWidth("5%");
    
    	setFields(nameField, valueField, actionField);
    	
    	ListGridRecord lr1 = new ListGridRecord();
    	lr1.setAttribute("name", "value1");
    	lr1.setAttribute("value", "exempleVal");
    	
    	ListGridRecord lr2 = new ListGridRecord();
    	lr2.setAttribute("name", "value2");
    	lr2.setAttribute("value", "BADBABA");
    	
    	ListGridRecord lr3 = new ListGridRecord();
    	lr3.setAttribute("name", "NWRNWRB");
    	lr3.setAttribute("value", "BADVWEVWEVWEBABA");
    	
    	ListGridRecord lr4 = new ListGridRecord();
    	lr4.setAttribute("name", "WRHWRH");
    	lr4.setAttribute("value", "VEVBQEQ");
    	
    	RecordList recList = new RecordList();
    	recList.add(lr1);
    	recList.add(lr2);
    	recList.add(lr3);
    	recList.add(lr4);
    	setData(recList);
        }
    
    }
    Attached Files
    Last edited by MirceaM; 31 Oct 2014, 07:40.
Working...
X