Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript > Bibliothèques & Frameworks > Ext JS / Sencha
Ext JS / Sencha Ext JS / Sencha Forum d'entraide sur les frameworks Ext JS et Sencha. Avant de poster : FAQ ExtJS / Sencha, Toutes les FAQ JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 10/04/2011, 16h40   #1
Invité régulier
 
Inscription : septembre 2007
Messages : 20
Détails du profil
Informations forums :
Inscription : septembre 2007
Messages : 20
Points : 8
Points : 8
Par défaut [Autocomplete et Json store] problème avec Autocomplete

je veux faire un champs de recherche avec auto-complétion pour ceci j'utilise un Json Strore et une combobox :


Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
var store = new Ext.data.JsonStore({
    url: 'Monurl',
    root: 'features',  // the root of the array you'll send down
     fields: ['type','id','geometry',{location:'location',name:'name'}]
});
 
var combo = new Ext.form.ComboBox({
    store: store,
    displayField: 'location',
    typeAhead: true,
    mode: 'remote',
    queryParam: '',  //contents of the field sent to server.
    hideTrigger: true,    //hide trigger so it doesn't look like a combobox.
    selectOnFocus:true,
    width: 250,
    renderTo: 'search'  //the id of the html element to render to.
                              //Not necessary if this is in an Ext formPanel.
});
avec displayField: 'location' le scripte crache(Uncaught TypeError: Cannot read property 'length' of undefined) mais j'ai testé avec displayField: 'id' et ça marche très bien donc mon problème c'est comment je peux accéder à 'location' ???
le format de JSon qui me renvoie le serveur est :

Code :
1
2
 
{"type":"Feature","id":"ar1","geometry":null,"properties":{"location":"locat","bbox":[xx,yy,x,y]}}
merci.
leo_OrNg est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/04/2011, 14h23   #2
Membre éclairé
 
Avatar de JulienFio
 
Julien Fiorentino
Inscription : novembre 2007
Messages : 201
Détails du profil
Informations personnelles :
Nom : Julien Fiorentino
Âge : 28
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations forums :
Inscription : novembre 2007
Messages : 201
Points : 336
Points : 336
peut-être comme ça:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var store = new Ext.data.JsonStore({
    url: 'Monurl',
    root: 'features',  // the root of the array you'll send down
     fields: ['type','id','geometry','properties']
});
 
var combo = new Ext.form.ComboBox({
    store: store,
    displayField: 'properties.location',
    typeAhead: true,
    mode: 'remote',
    queryParam: '',  //contents of the field sent to server.
    hideTrigger: true,    //hide trigger so it doesn't look like a combobox.
    selectOnFocus:true,
    width: 250,
    renderTo: 'search'  //the id of the html element to render to.
                              //Not necessary if this is in an Ext formPanel.
});
JulienFio est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 00h35.


 
 
 
 
Partenaires

Hébergement Web