Hi All,
I spent a good while on Friday searching for a neat solution to this but
I couldn't find one. I'm attempting to send a bunch of information using
JSON to a dojox.grid.Grid using dojox.data.QueryReadStore to get the
information from my controller. My problem is that I want to escape this
content before sending it to the store as I can't see a way of using a
view helper to do this I believe it needs to be done in the controller.
Is there a neat solution to this? I've currently got this sample code
(below) in place to make the grid display the content correctly but I'm
thinking there must be a neater way of doing this without writing my own
helper to do this?
Has anyone else come across this problem? Or am I going about this the
totally wrong way?
Cheers,
Jamie
$data = $this->_model->fetchDashboard();
$filter = new Zend_Filter_HtmlEntities();
$new_data = array();
foreach($data as $elem => $record) {
$new_record = array();
foreach($record as $ident => $attr) {
$new_record[$ident] = $filter->filter($attr);
}
$new_data[$elem] = $new_record;
}
$this->_logger->debug($new_data);
$dojoData = new Zend_Dojo_Data('message_id', $new_data, 'dashboard');
$dojoData->setMetadata('numRows', 10);
echo $dojoData->toJson();
exit;