| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 
 |  
//L'objet principal
var mes_checkboxs = function (){
 
 
//Creation du store
this.store = new Ext.data.Store({
      storeId:'store1',
      autoload:true,
      fields:['champ1', 'champ2','champ3'],
      proxy: {
            type: 'ajax',
            url:'monurl.php',
            reader: {
	            type: 'json',
	            root: 'data'
            }
      }
}).load(function(records,operation,success){
          var test = appel.mon_objet.store.getAt(0); //recupere l'enregistrement à l'index spécifié
          var test2 = appel.mon_objet.store; //pour appeler le store
          var nbre = test2.getCount(); //nombre de valeurs récupérées
          registre.checkbox.form.removeAll(); //efface tous les champs du form
 
          for(var i = 0; i < nbre;i++){
               test = appel.mon_objet.store.getAt(i);
               appel.mon_objet.checkboxgroup = null; //vide l'objet checkboxgroup au cas ou non vide avant
               var lacheckbox ={ //creation de la structure de l'objet
                    xtype:'checkbox',  
                    boxLabel : test.get('champ1'),
                    fieldLabel: '',
                    labelWidth:  150,
                    checked: true,
                    name: 'toto'			
               };
               appel.mon_objet.form.add(lacheckbox); //ajoute les objets un par un (pas de tableau) à mon form
        }
});
 
	this.checkboxgroup = {}; //creer l'objet vide pour le declarer au constructeur de la classe
 
//objet formulaire de la fenetre
	this.form = new Ext.form.Panel({
		layout:'anchor',			 			
		bodyPadding:'10 10 10 10',	//padding
		url: 'autre_url.php',
		defaults:{
			anchor:'75%',
			labelAlign: 'right',
			labelWidth:  100
		},
		id:'form_checkbox',		
		items:[{
 
		},
			this.checkboxgroup	
		]
	});
 
}; | 
Partager