PDA

View Full Version : FormSelect with array?



kevinv1990
10 Jan 2011, 1:10 AM
Hello all,

Want to load the Locations dynamic from a json, this all goes good and it works on desktop too, i load them in the select and they are shown on the desktop, but I can't press on the select box on the phone, (the pop up to select the location doesn't show, it works in google chrome on the desktop).

Anyone knows how to make this work on the iphone.

Make an array with datastore location values


// Automatisch locaties inladen.
var optionsLocations = [];

datastore3.each(function(rec){
optionsLocations.push({
value: rec.get('locatie'),
text: rec.get('locatie')
});
});

The formpanel:


{
xtype: 'fieldset',
cls: 'searchFormBody',
items: [
{
xtype: 'select',
id: 'locatieSelect',
label: 'Welke Locatie?',
options: optionsLocations,
listeners: {
change: function(select, value){
if(value === 'Alle Locaties'){
this.get(distanceSlider).hide();
} else {
this.get(distanceSlider).show();
}
},
scope: this
}
},


So i can press on the select when i use desktop google chrome, but not when i use safari on iphone. Someone knows how this works?

kevinv1990
10 Jan 2011, 8:22 AM
Still don't know how to fix :(

Someone can look into the problem?

kevinv1990
11 Jan 2011, 2:20 AM
bump

tomalex0
11 Jan 2011, 8:48 PM
Is this another component?


this.get(distanceSlider)


Are you looking for something like show/hide some panel based on the Select Box selection?

Could you provide a working demo of this.

kevinv1990
12 Jan 2011, 12:31 AM
Hey,

Thanks a lot for the reply. In short I want: a select field with values that are loaded from datastore or array.

So let's say my form must search on location, but only the locations are shown in the select (dropdown) of the locations which are in the Json, I dont want that people can search on let's say new York, if there are no results on New York.

At the moment i have it working, but I can't press the select field on the iphone, the pop up to select a city doesn't show, probably i am doing something wrong, the desktop browser catches it and fix it, the iphone doesn't.

Kevin

tomalex0
12 Jan 2011, 3:43 AM
Iphone will be showing a picker in the case of selectfield and for empty store, picker will be not shown.

I think that will be the reason.

kevinv1990
12 Jan 2011, 4:05 AM
When i log the datastore it shows 5 values, when i put: store: datastoreName, i get the good amount of fields, but they are empty (no location is shown as 'New York', but exactly 5 empty select fields are shown. The reason for this may be because all objects in the datastore have only one value? (location name), i do this so i won't get duplicated Location names.

Kevin

tomalex0
12 Jan 2011, 4:12 AM
If you can provide a test code, i can look in to it

kevinv1990
12 Jan 2011, 6:11 AM
Thanks for the support tomalex0,

Guess what? Yeah i found out why it was not working, all code i wrote was working from the start, even the options: arrayName here is no problem and has nothing to do with the fact that the ontap doesn't work on mobile.

The problem lies in the fact that i didn't give a Name attribute to it...

Seriously sencha dev team. Why you need a name attribute for the on tap handler, couldn't you use ID which most people use anyway, since we want components to have unique value?

Kevin