Bonjour,

Voici un code php/ajax[Et plus précisément php-ext qui génère du extJS]

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
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
 
function LoadData($fichier)
{
	$checkColumn = new PhpExtUx_Grid_CheckColumn("Select");
	$checkColumn->setDataIndex(utf8_encode("Séléctionner"));
	$checkColumn->setWidth(55);	
 
	$editStrBox = PhpExt_Form_ComboBox::createComboBox("cmbLight")
         		->setTypeAhead(true)
				->setTriggerAction(PhpExt_Form_ComboBox::TRIGGER_ACTION_ALL)
				->setTransform("light") #?
				->setLazyRender(true)
				->setListCssClass('x-combo-list-small');
 
	$editNumBox = PhpExt_Form_NumberField::createNumberField("txtPrice")
				->setAllowBlank(false)
				->setAllowNegative(false);
 
 
	// Chargement du fichier xml
	$store = new PhpExt_Data_Store($fichier);
	//$store->setUrl($fichier)
	$store->setUrl($fichier)
		  ->setReader($reader);
 
	$colModel = new PhpExt_Grid_ColumnModel();
	$colModel->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Author","Author",null,120, null, null, true)
				->setEditor($editStrBox))
			 ->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Title","Title",null,180,null,null, null, true)
			 	->setEditor($editStrBox))
			 ->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Manufacturer","Manufacturer",null,115,null,null, true)
			 	->setEditor($editStrBox))
			 ->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Product Group","ProductGroup",null,100,null,null, true)
			 	->setEditor($editStrBox))
			 ->addColumn($checkColumn);
 
	$grid = new PhpExt_Grid_GridPanel();
	$grid->setStore($store)
		 ->setColumnModel($colModel)
		 ->setHeight(600)
		 ->setWidth('auto');
}
 
$btnElementViewVendeur = PhpExt_Element::getByID("btnViewVendeur");
$btnViewVendeur = PhpExt_Button::createTextButton("Afficher la liste");
$btnViewVendeur->setId('btnViewVendeur');
$btnViewVendeur->setMinWidth('197');
 
$btnHandlerViewVendeur = PhpExt_javascript::functionDef(null,
			 LoadData("sheldon2.xml")); //N'est pas pris comme fonction PHP
 
$p2->addItem($btnViewVendeur);
Comme vous le voyez, mon bouton sera générer en JS, et par conséquent sa me formera le code suivant:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
Ext.Element.get('btnViewVendeur').on('click',function() {
 LoadData("sheldon2.xml");
 });
Le problème est que JS ne peut charger du php, ma question est donc:
"Comment appeller la fonction php lors du click du bouton généré en extjs?"

Meilleures salutations,

Yannick