on 10-18-2016 1:03 AM
I am trying to populate all us states in a drop down, do we have any built in service which return all the US states ? Thanks in advance.
Hi Khaja,
I assume you are referring to "regions" as "states"
Data related to regions & countries can be found in countries.impex
INSERT_UPDATE Country;isocode[unique=true];name[lang=en];active[default=true]
;US;"United States"
INSERT_UPDATE Region;country(isocode);isocode[unique=true];isocodeShort;name[lang=en];active[default=true]
;US;US-AL;AL;"Alabama"
;US;US-AK;AK;"Alaska"
;US;US-AZ;AZ;"Arizona"
;US;US-AR;AR;"Arkansas"
;US;US-CA;CA;"California"
;US;US-CO;CO;"Colorado"
;US;US-CT;CT;"Connecticut"
You can use the getRegionsForCountryIso method in DefaultI18NFacade
@Override
public List<RegionData> getRegionsForCountryIso(final String countryIso)
{
final CountryModel countryModel = getCommonI18NService().getCountry(countryIso);
final List<RegionModel> regions = new ArrayList<RegionModel>(countryModel.getRegions());
Collections.sort(regions, RegionNameComparator.INSTANCE);
return Converters.convertAll(regions, getRegionConverter());
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.