Hey everyone.
I've created a little mvc application with extjs. I setup ext.direct to comunicate with the server side ( PHP server).
In my app menu, when I click on a button, I want to call a PHP method and receive the data (with the data I want to create a dynamic form but it's not really important now)
Everything seem to work fine. I call the php method, and in my browser javascript console, I see the result.
But how can I catch this result ???
In my main application I've add an ext.direct provider like this :
Code:
Ext.application({
name: 'client_app'
,appFolder: 'client_app'
,autoCreateViewport: false
,launch: function() {
Ext.direct.Manager.addProvider(Ext.app.DirectAPI);
}
});
my api.php :
PHP Code:
<?php
session_start();
// Include ExtDirect PHP Helpers
require_once('ExtDirect/API.php');
require_once('ExtDirect/CacheProvider.php');
$cache = new ExtDirect_CacheProvider('cache/api_cache.txt');
$api = new ExtDirect_API();
$api->setRouterUrl('server_app_php/router.php'); // default
$api->setNamespace('Ext.app');
$api->setDescriptor('Ext.app.DirectAPI');
$api->setDefaults(array(
'autoInclude' => true,
'basePath' => 'classes'
));
$api->add(
array(
'Authentification',
'Form'
)
);
$api->output();
$_SESSION['ext-direct-state'] = $api->getState();
and finally in a controller of my app (Header.js) :
Code:
Ext.define('client_app.controller.Header', {
extend: 'Ext.app.Controller'
,views: [ 'Header']
//à l'initialisation du controlleur
,init: function() {
this.control({
'header_menu button[action=dspManageMandate]' :{
click: this.testevent}
});
},
testevent: function() {
// In this function I try to
var callback = function(response, e){
//This alert never show so we never get in this function. Don't understand
//why ??
alert('Call back ok = '+e.status);
}
//There is my call which seem to work, because I see the JSON answer in my browser console
Ext.app.Form.getForm(callback);
//var dynForm = Ext.create('client_app.view.Dynamic_form').show();
//edit.down('form').loadRecord(record);
},
});
If someone could explain my how catch my php method answer. Or explain me why my app never go into my "callback" function. Or give my an sample or anything.... I would really appreciate !!!
I'm on it since 3days and I really don't know what to do....
I check these web page but still don't understand my problem ;
http://blog.extjs.eu/know-how/master...direct-part-3/
http://www.sencha.com/products/extjs/extdirect