PDA

View Full Version : Allowing user to remove the selected item in the combobox



r_honey
24 Jan 2010, 5:56 AM
I have a combobox with allowBlank=true, editable=true.

Now, if this combobox has an item selected, and the user tries to clear the selected item by selecting all text, pressing delete and then navigating to another control by mouse or through tab, combobox restores its previously selected value.

How can I allow the user to clear the combobox, and leave it blank, when an item is already selected??

24 Jan 2010, 7:30 AM
There is an extension to the twin trigger field in the forums (use the google search), which allows you to implement a combo with a 'clear' button.

r_honey
24 Jan 2010, 9:11 AM
Hi jgarcia, I dont think this should require any extension. I was expecting something out-of the box, as this should be a common issue for many people.

As a workaround, I have already added an additional trigger to the combobox, which when clicked clears the combo as:
this.setValue('');

24 Jan 2010, 9:31 AM
Yes, but it does not.

A cleaner solution would be to create a reusable component, tucked away in your reusable area namespace. But what ever ;)

r_honey
24 Jan 2010, 11:36 AM
Were you talking of this:
http://www.extjs.com/forum/showthread.php?p=76662

24 Jan 2010, 12:07 PM
pretty much - yes.

When developing Ext JS applications, I always strive for reusability, which is what I'm writing about in my book (see my sig).

http://tdg-i.com/img/screencasts/2009-12-13_1114.png
http://extjsinaction.com/70/final-application-is-complete-writing-on-the-last-two-chapters-to-commence

r_honey
24 Jan 2010, 12:16 PM
Hi jgarcia, I also strive for re-usability as much as I can. Having said that, my first concern here was to get the code working. Even setValue('') failed, and combo restored its value on blur. Eventually, clearValue() settled it all.

Regarding your book, ;)
Be rest assured, I have read that other (11+ page) long thread, where you are discussing your book.

24 Jan 2010, 12:32 PM
Part of the reason I am marketing the book is not because I make lots of money on it. It's because it spreads knowledge, which is why I agreed to write it. I was approached by Manning because other proposals failed. At the time (May 2008), I had over 7000 posts on this forum, most of which is providing free help to developers like yourself. ;)

It is for this reason why I have 10 screencasts (with more on the way this year) that span more than 35 minutes in some cases. I also write blog articles for Ext JS (just one thus far, but a few more in the works) and articles for JSMag - all to help people learn the framework.

So, if my post above (and others) come across like a general marketing ploy, I am sorry. My goal is just to help people learn the framework.

http://www.nelsonguirado.com/media/blogs/religion/shrug.jpg

r_honey
24 Jan 2010, 12:50 PM
That was just said in a light mood jgarcia. I really appreciate people like you, Animal and others providing support for free. I never made that remark with money in mind.

I extend my apologies for that remark and I am editing the post to remove it. I again feel sorry if I offended you even remotely.

24 Jan 2010, 12:52 PM
no offense taken dude. Others have made similar remarks and I think it's good to justify my actions. Please don't remove that post. :)

r_honey
24 Jan 2010, 1:00 PM
That's already gone for good!!! Sorry...