-- Jamie Sutherland <[email protected]> wrote
(on Monday, 19 January 2009, 09:49 AM -0000):
> 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?
I'd do this:
$data = $this->_model->fetchDashboard();
if (!is_array($data) && method_exists($data, 'toArray')) {
$data = $data->toArray();
} else {
// throw exception?
}
array_walk_recursive($data, 'htmlentities');
$dojoData = new Zend_Dojo_Data($data);
This poses an interesting issue though: Zend_Dojo_Data should likely
have the ability to specify an output filter chain. Care to file an
issue in the tracker?
--
Matthew Weier O'Phinney
Software Architect | [email protected]
Zend Framework | http://framework.zend.com/