PDA

View Full Version : Disable dropdownlist in combobox



paweluz
16 Jun 2010, 4:21 AM
Hi!

I was wandering if anyone know how to disable the dropdownlist in the combobox? Is this possible? This would really help me.... I have been trying to use different parameters but non of them works.

Please, can anyone help me

Regards,
Poul

paweluz
16 Jun 2010, 8:10 AM
Can anyone please help me with that... maybe someone had this same problems. I am just going to say that the data that are filtered using combobox are presented in the grid - so the dropdown list in the combobox would not be needed anymore for me...

Any ideas would be great...

regards,
Poul

fay
16 Jun 2010, 8:11 AM
Why not just use the disable() method?

paweluz
16 Jun 2010, 10:09 PM
Hi

Thanks for the reply but unfortunately disable does not work. I have been trying with method setdisable(), and parameter disable. First disabled the hole combobox (I could not write in it), second does not work. I want to give the user the hole combobox functionality besides dropdownlist. Do you know maybe other solutions for that...

Poul

fay
17 Jun 2010, 12:37 AM
I want to give the user the hole combobox functionality besides dropdownlist.


This doesn't make any sense to me, so you want a Ext.form.TextField (http://www.sencha.com/deploy/dev/docs/?class=Ext.form.TextField)?

paweluz
17 Jun 2010, 1:37 AM
Yes, you might say that I want the textFiled functionality in the combobox. I already have working prototype with the combobox, I have connection to the database (store). I have red the API about the textfield and I did not find a information how to connect to the database (store). TextField does not have the store parameter, that allows you do do the query immediately. There are many working examples how to use combobox and store, and there are non how to use textfiels and store. I know that now using textfield seems to be the good idea. I did not think that disabling the dropdown list in combobox may causes so many problems...

What do you think...?

Animal
17 Jun 2010, 1:41 AM
What functionality do you want then?

An autocomplete with no dropdown?

I'm sure it can be done with ComboBox.

First thing is hideTrigger: true

Not showing the dropdown will take some looking at code.

Aren't you just spoiling the user experience though? People like to see possible choices.

fay
17 Jun 2010, 1:59 AM
In addition to hideTrigger, you could also write your own ComboBox extension and override the restrictHeight method. Something like:



Ext.form.HeightLessComboBox = function(config) {
Ext.form.HeightLessComboBox.superclass.constructor.call(this, config);
};

Ext.extend(Ext.form.HeightLessComboBox, Ext.form.ComboBox, {
restrictHeight : function(){
this.innerList.setHeight(0);
}
});

paweluz
17 Jun 2010, 2:05 AM
Hi

Thanks for the reply! As I have said before I have everything working besides this dropdown list that I just would like to get ride of. I have found the working example witch textfield on the API page of extJS
http://www.sencha.com/deploy/dev/docs/. In the left top cornet you may
see that while you type in the textfield, the tree below is changing...
I want this same solution using just combobox (becouse I have it working, connected to the database) and grid.
So as you can see all the possible choices would be displayed in the grid. Then user will be able to click on the cell
that he choose.


Regards,
Poul

Animal
17 Jun 2010, 2:27 AM
It's useless as a UI.

I just tried this in a combobox and you get NO HELP whatsoever without the list.

Go to the combos example page and disable the dropdown on state selection. Type "M", and you get "Maine" shown. But you have no idea about what else is available (assuming of course you don't know the "M" states!!!, but the principle applies)

Animal
17 Jun 2010, 2:28 AM
I get it!

You are filtering a grid, so you can see some feedback!

OK, then just use a TextField, and a keyup listener, and call filter() on the Store. Very simple.

paweluz
17 Jun 2010, 2:55 AM
What do you mean by saying 'disable the dropdown on state selection.' How to do this is my main question. I have been looking on the sample page with all the combo boxes and I could not find what you told me... Can you please explain what you mean?

Poul

paweluz
17 Jun 2010, 2:57 AM
Hi fay

I have tried your code and it does not work for me. The dropdown list still appears...


In addition to hideTrigger, you could also write your own ComboBox extension and override the restrictHeight method. Something like:



Ext.form.HeightLessComboBox = function(config) {
Ext.form.HeightLessComboBox.superclass.constructor.call(this, config);
};

Ext.extend(Ext.form.HeightLessComboBox, Ext.form.ComboBox, {
restrictHeight : function(){
this.innerList.setHeight(0);
}
});

Animal
17 Jun 2010, 3:01 AM
Just use a TextField with a keyup listener!

paweluz
17 Jun 2010, 3:03 AM
Ok, thanks for your help.

Regards,
Poul