PDA

View Full Version : how to replace entered character with '?' to filter combobox in extjs



raj542
3 Apr 2012, 8:04 PM
I had a requirement like,
In combo box a drop down list is there, extjs filters the list
when we enter any text characters like 'b'... which will display all words starting with 'b'.

Requirement:
while filtering values in combo box, a '?'(question mark) specifies any match from a to z and 0 to 9
Example:i have a list of values like
1.raja 2.123 3.ram 4.10211.In the combobox if i enter '?' it should display all values
2.If i enter '?a' it should display raja,ram
3.If i enter '?2?' it should display 123
4.If i enter '?0?1' it should display 1021

Thanks,
Rajasekhar

JambaFun
4 Apr 2012, 12:04 AM
Hi raj542,

My advice is get familiar with the ExtJS source code. Most non-standard requirements require you to implement your own classes that override functionality from its base class, i.e. ExtJS core.

In your particular case you could do by just filtering on the server side. However, if that is not an option you would have to create a class which override the doQuery method of ComboBox so that it uses a different filtering class than Ext.util.Filter. The reason being that Ext.util.Filter does not have the functionality you require. You would also have to write that filtering class yourself.

All this I got from just reading the source (ExtJS 4.1 RC1).

raj542
4 Apr 2012, 1:31 AM
Hi JambaFun,

Thanks for the post.Can you please guide me with a sample just like a direction of how to solve the problem.

Can you Please give me a sample of overriding the filter in our own class..

JambaFun
4 Apr 2012, 1:55 AM
Have you tried yourself?
Have you looked at the source code?

http://docs.sencha.com/ext-js/4-0/source/ComboBox.html#Ext-form-field-ComboBox-method-doQuery

This is not rocket science if you understand the source code. If you don't you need to work harder at learning JavaScript.

khmurach
9 Apr 2012, 12:53 AM
Try this http://ext4all.com/post/how-to-filter-combobox-by-query-with-special-symbol