Hi, 
I want to specify 3 editor types (password, text and integer) in a certain ListGrid field. I saw 3 ways to do it:
1) by definining CellRenderer (in this post: http://forums.smartclient.com/showthread.php?t=12013). I understand that cell renderer renders a cell view. How can it change the editor type using it? I am confused..
2) by overriding getEditorType() in JSNI. I can't use the straight-forward implementation that returns "PasswordItem" or "TextItem", because in Integer field I need to return a text item with KeyPressFilter.
The best way I found is to invoke a smartGWT function on my listGrid implementation. It had another problem: I couldn't get the edited row (getFocusRow() and getEventRow() return wrong values in certain scenarios: if you navigate with arrows and listgrid field contains a validation error)
	3) override canEditCell() and set different editorType and validators on the valueField. It has a problem as (2): when grid contains errors, arrows navigation shows wrong editors.
	
What is the preferred way? Please help me to continue from here
thanks
					I want to specify 3 editor types (password, text and integer) in a certain ListGrid field. I saw 3 ways to do it:
1) by definining CellRenderer (in this post: http://forums.smartclient.com/showthread.php?t=12013). I understand that cell renderer renders a cell view. How can it change the editor type using it? I am confused..
2) by overriding getEditorType() in JSNI. I can't use the straight-forward implementation that returns "PasswordItem" or "TextItem", because in Integer field I need to return a text item with KeyPressFilter.
The best way I found is to invoke a smartGWT function on my listGrid implementation. It had another problem: I couldn't get the edited row (getFocusRow() and getEventRow() return wrong values in certain scenarios: if you navigate with arrows and listgrid field contains a validation error)
Code:
	
	    protected native JavaScriptObject create()/*-{
        var config = this.@com.smartgwt.client.widgets.BaseWidget::getConfig()();
        var scClassName = this.@com.smartgwt.client.widgets.BaseWidget::scClassName;
        var widget = $wnd.isc[scClassName].create(config);
//overwrite this method as an entry point to check the editorType
        widget.getEditorType = function (field, values) {
            if(field.masterIndex==2){
                //run function on listgrid and set the editors and validators
                $wnd.teststst(field.masterIndex);
            }
            var editorProperties = $wnd.isc.addProperties({},field,field.editorProperties);
            return $wnd.isc.DynamicForm.getEditorType(editorProperties, this);
        }
        this.@com.smartgwt.client.widgets.BaseWidget::doInit()();
        return widget;
    }-*/;
Code:
	
	   protected boolean canEditCell(int rowNum, int colNum) {
        String fieldName = getFieldName(colNum);
        if (fieldName.equals("value")) {
         valueField.setEditorType(myRecord.getEditorType());
         valueField.setValidators(myRecord.getValidators());
        }
        return super.canEditCell(rowNum, colNum);
    }
What is the preferred way? Please help me to continue from here
thanks

Comment