PDA

View Full Version : how clear text from SearchField.js



bee
30 Oct 2011, 6:40 PM
Hi, I am using exiting Search Field (examples (http://www.java2s.com/Open-Source/Javascript/UI-Library/extjs/ext-4.0.1/examples/Catalogexamples.htm) ux (http://www.java2s.com/Open-Source/Javascript/UI-Library/extjs/ext-4.0.1/examples/ux/Catalogux.htm) form (http://www.java2s.com/Open-Source/Javascript/UI-Library/extjs/ext-4.0.1/examples/ux/form/Catalogform.htm) SearchField.js) .I want to clear the text from search text.

mitchellsimoens
31 Oct 2011, 5:27 AM
field.setValue('');

bee
31 Oct 2011, 7:36 PM
thx Michael, I used the below piece of code , but still didn't work.

onTriggerClear: function(el) { return function() {
if(el.field.getValue()) {
el.field.setValue('');
el.field.focus();
el.onKeyUp();
}
}
}
but it didn't clear the text. should i use it separately ?