View Full Version : Null item in a ComboBox
As said here (http://extjs.com/forum/showthread.php?p=324712), we cannot just add a null value in a ComboBox. I guess this feature would be useful for a lot of people, instead of handling a fake model representing a null value each time you allow a null value.
This wont be added. It is completly against the structure of how combobox handles the data.
This wont be added. It is completly against the structure of how combobox handles the data.
It is also completely a part of what we could expect from a ComboBox... And it seems to be possible (set editable to true and type an empty value in the field do the job).
This is something different as explained in the orginal thread.
ivotte
13 Sep 2010, 12:32 AM
Hi,
i am not sure if replying to such a old thread will be noticed, but I have to agree with sdc that handling null in a combobox would be very useful for the daily work of many people. Of course, it is possible to add a model representing "null", but when this "null" model is selected, getValue() returns this model and not null. Then the programmer has to implement a special handling for this model, which is additional work. Also adding a "null" model itself is not done in a single line of code.
I think in many applications, selecting one item of a model list or selecting nothing is a very common use case (think of an nullable foreign-key column in a database). Is it not important to handle this conveniently?
A ListStore does not even handle a null value. So there is no way to get it into a ComboBox. The only way would really be to have a model that represents null at the moment, or you need a button to clear the combobox (so that there is no value)
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.