Après quelques recherches, je suis tombé sur un jqgrid action helper que je pouvais inclure dans mon Zend MVC. Cependant après avoir téléchargé la source et d'essayer de l'utiliser, je reçois cette erreurObtenir une aide d'action jqgrid pour travailler
Fatal error: Call to a member function getActionController() on a non-object in
.....
\Controller\Action\HelperBroker.php on line 299
Voici un extrait de l'aide
class My_Helper_jqgrid extends Zend_Controller_Action_Helper_Abstract {
/**
* Instance of the config file.
*
* @var Zend_Config_Ini
*/
protected $_config = null;
/**
* The instance of the database
*
* @var Zend_Db_Adapter_Abstract
*/
protected $_db = null;
/**
* The provided view
*
* @var Zend_View_Interface
*/
protected $_view = null;
/**
* The options provided to this helper
*
* @var array
*/
protected $_options = array();
/**
* @var Zend_Loader_PluginLoader
*/
public $_pluginLoader;
public function __construct(Zend_View_Interface $view = null, array $options = array()){
//$this->_db = Zend_Registry::getInstance()->get("db");
$this->_db = 'mato';
$this->_pluginLoader = new Zend_Loader_PluginLoader();
$this->_view = $view;
$this->_options = $options;
}
/**
* Strategy pattern: call helper as broker method
*
* @param string | Zend_Db_Table_Select $sql
* @param string | array $columns
*/
public function direct($sql, $columns = "*", $tableId = "id", array $options = array()) {
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender();
Zend_Controller_Action_HelperBroker::getStaticHelper('layout')->disableLayout();
$this->_options = $options;
$page = $this->getRequest()->getParam("page", 1); // get the requested page
$rows = $this->getRequest()->getParam("rows", 20); // get how many rows we want to have into the grid
$sidx = $this->getRequest()->getParam("sidx", $tableId); // get index row - i.e. user click to sort
$sord = $this->getRequest()->getParam("sord", "asc") == "desc" ? "DESC" : "ASC"; // get the direction
$response = new stdClass(); // The response object which will be translated into a json object
...............
................
return json_encode($response);
}
}
Dans mon contrôleur
print $this->_helper->Jqgrid("SELECT * FROM artist",
array("artist_code","artist_name","artist_album"), "id");
Dans mon bootstrap
Zend_Controller_Action_HelperBroker::addPath(
APPLICATION_PATH . "/controllers/helpers", "My_Helper");
Qu'est-ce qui me manque?
Il peut être utile de poster un exemple de code ... –