PDA

View Full Version : Change empyText config



DJ JJ
19 Mar 2011, 12:38 PM
Hi! I have got a Combobox with a defined emptyText config. I need to change it via code, but I can't find anything in the API, just the setValue(), but it seems different because text in emptyText is grey and text after setValue() is black, so it's not very goodl. How can I change emptyText??

fay
20 Mar 2011, 4:15 AM
You could try:



combo.emptyText = 'new empty text';
combo.reset();

DJ JJ
20 Mar 2011, 4:26 AM
mmm.. It works, but not as I want. The problem is that I have a card layout with some forms inside. There is a combobox on the first form where I choose an option. After selecting, the emptyText of the next card must change. With your code I can change the value of the empyText, but when I pass to the next card the value is replaced as original.

fay
20 Mar 2011, 4:40 AM
I'm not 100% sure I'm following you, but you could also try:



combo.emptyText = 'new empty text';

// I think this is a private method so be careful relying upon it in the future.
combo.applyEmptyText();

combo.reset();


I'd recommend taking a look at the source (ext-all-debug-w-comments.js) for Ext.form.ComboBox and see how it handles emptyText.

DJ JJ
20 Mar 2011, 5:58 AM
It works, thank you :)