PDA

View Full Version : Leading and trialing spaces in EditableGrid?



salmondavid888
12 Oct 2011, 3:03 AM
Hi,
in the example of EditableGrid, if we edit any text field and insert blank spaces before and after the value then grid still shows blank spaces before and after the value. please suggest me how to remove leading and trialing spaces if user enters in any of the field in EditableGrid. the solutiion what i know is, after edit getting the value and apply trim() and set the same into model. other than this is there any best way to achieve this? is it possible to override getValue() of Field class? pleas help me?


Thanks,
Salmon

catalin.ciobanu
12 Oct 2011, 6:46 AM
TextField<String> tf = new TextField<String>(){
@Override
public String getValue() {
//+ your implementation
//- return super.getValue();
}
};

Colin Alworth
17 Oct 2011, 6:09 AM
Another option would be to implement postProcessValue of the EditorCell and trim the text there.

salmondavid888
17 Oct 2011, 7:16 AM
Hi Colin, Thanks for your reply. please can you give me a code snippet? or postProcessValue is available in which class to override? Please help me!
Thanks!

Colin Alworth
17 Oct 2011, 12:20 PM
When you create a CellEditor, subclass it and override the postProcessValue method.

salmondavid888
18 Oct 2011, 6:46 AM
Hi colin thanks for your quick help.