GXT 3.x EditorGrid: choose cell editor type on a cell by cell basis -


is there anyway define editor type on cell cell basis in gxt 3.0?

i need create transposed table; column become row , row column. being case, column (from normal table point of view) have various editor type, whereby row have identical editor type.

i trying use following approach - seems working fine, , allow open editors based on data type when click out; doesn't close/hide editor.

i appreciate if can please point me in right direction.

final gridinlineediting<mymodel> editing = new gridinlineediting<mymodel>(mygrid){         @suppresswarnings("unchecked")     @override public <o> field<o> geteditor(columnconfig<mymodel, ?> columnconfig) {         if(valuecolumnname.equals(columnconfig.getheader().asstring())) {                 mymodel mymodel = tree.getselectionmodel().getselecteditem();             if(mymodeltype.string.equals(mymodel.getmymodeltype())) {                 textfield textfield =  new textfield();                 textfield.setallowblank(boolean.false);                 return (field<o>) textfield;             }             else {                 textarea textfield =  new textarea();                 textfield.setallowblank(boolean.false);                 return (field<o>) textfield;             }         }         return super.geteditor(columnconfig);     } }; editing.setclickstoedit(clickstoedit.two); 

ps: similar question below; answer specific post gxt 3.0. new stackoverflow , seems recommendation create new question instead of adding new post old thread. gxt editorgrid: choose cell editor type on cell cell basis

after playing around day; colleague(praveen) , figured out. instead of trying override gridinlineediting's geteditor() method override startediting() method. also, need converters if have data date, list etc. below sample code; hope others.

final gridinlineediting<mymodel> editing = new gridinlineediting<mymodel>(tree){             @override public void startediting(gridcell cell) {                 mymodel mymodel= tree.getselectionmodel().getselecteditem();                 if(mymodeltype.text.equals(mymodel.getcontextvariabletype())) {                     textarea textfield =  new textarea();                     textfield.setallowblank(boolean.false);                     super.addeditor(valuecolumn, textfield);                 }                 else if(mymodeltype.boolean.equals(mymodel.getcontextvariabletype())) {                     simplecombobox<string> simplecombobox = new simplecombobox<string>(new stringlabelprovider<string>());                     simplecombobox.settriggeraction(triggeraction.all);                     simplecombobox.add("yes");                     simplecombobox.add("no");                     super.addeditor(valuecolumn, simplecombobox);                 }                 else if(mymodel.integer.equals(mymodel.getcontextvariabletype())) {                     spinnerfield<integer> spinnerfield = new spinnerfield<integer>(new integerpropertyeditor());                     spinnerfield.setincrement(1);                     converter<string, integer> converter = new converter<string, integer>(){                         @override public string convertfieldvalue(integer object) {                             string value = "";                             if(object != null) {                                 value = object.tostring();                             }                             return value;                         }                         @override public integer convertmodelvalue(string object) {                             integer value = 0;                             if(object != null && object.trim().length() > 0) {                                 value = integer.parseint(object);                             }                             return value;                         }                     };                     super.addeditor(valuecolumn, converter, (field)spinnerfield);                 }                 else {                     textfield textfield =  new textfield();                     textfield.setallowblank(boolean.false);                     super.addeditor(valuecolumn, textfield);                 }                 super.startediting(cell);             }         };         editing.setclickstoedit(clickstoedit.two); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -