Hello,
i fill a dropdown with dynaic content from json and it does not show all entries? How can i fix that?
Attached the screenshots where you can see that tehere are more entries and here is the code:
/// <summary>
/// Setups the country dropdown.
/// </summary>
private void SetupCityDropdown( JsonData data ) {
DropdownCities.gameObject.SetActive (true);
DropdownCities.options.Clear();
List <City> tmp_city_data = new List<City> ();
city_data = new List<City> ();
City start_select = new City();
start_select.Postalcode = "nothing_selected";
start_select.PlaceName = "Bitte wählen...";
for (int i = 0; i < data["all_cities"].Count; i++)
{
Debug.Log("placeName= "+ data["all_cities"][i]["placeName"]);
City newCity = new City ();
newCity.ID = i;
newCity.CountryCode = data ["all_cities"] [i] ["countryCode"].ToString();
newCity.PlaceName = data ["all_cities"] [i] ["placeName"].ToString();
newCity.Postalcode = data ["all_cities"] [i] ["postalcode"].ToString();
newCity.Lng = float.Parse(data ["all_cities"] [i] ["lng"].ToString());
newCity.Lat = float.Parse(data ["all_cities"] [i] ["lat"].ToString());
tmp_city_data.Add (newCity);
}
//sort list by ??
city_data = tmp_city_data.OrderBy(o=>o.PlaceName).ToList();
city_data.Insert(0, start_select);
//write to DropdownCountry
int counter = 0;
foreach(City city in city_data)
{
if (counter > 0) {
DropdownCities.options.Add(new Dropdown.OptionData(city.Postalcode + ", " +city.PlaceName));
}
counter++;
}
LabelDropDownCities.text = city_data [1].PlaceName;
DropdownCities.GetComponent<Dropdown> ().value = 1;
pageViewController.hideLoading ();
DropdownCities.Show ();
}

