PDA

View Full Version : CountryField



thzero
22 Nov 2007, 11:00 AM
Here is a country field combobox that displays a small flag icon next to the right of the combobox.

To install, just unzip to the your ext script folder and see the examples\form\country.html for an example. To use the contol, just include the following two javascripts:

ux\widgets\form\CountryField.js
ux\widgets\form\CountryFieldStore.js

and the following style sheet:

resources\css\ext-ux-countryfield.css

A quick example of creating a CountryField is as follows:



new Ext.ux.CountryField({
fieldLabel: 'Country',
name: 'country',
maxHeight: 200,
typeAhead: true
});


By default the control uses the local store defined in the CountyFieldStore.js, if you want to use your own custom store (local or remote) just define, as normal, a 'store' property and a 'mode' property, etc.

The download is available from http://www.thzero.com/programming/extjs/CountryField.zip as it is too big [240kb] too attach (due to the country images included).

temporary
22 Nov 2007, 4:08 PM
Nice. Can the countries be easily translated?

thzero
22 Nov 2007, 4:19 PM
Sure, supply your own store based on the language you want displayed.

JorisA
25 Nov 2007, 1:21 PM
Looks nice, but you might want to have a look at this:
http://extjs.com/learn/Tutorial:Extending_Ext_Class