Yes it is supposed to as far as I know.
I had similar problems with AjaxContent. And I used
$contextSwitch = $this->_helper->getHelper('contextSwitch');
instead.
I call all my ajaxified actions with /format/xml or format/json or format/html
This solved my problems.



On Mon, Nov 2, 2009 at 12:47 PM, tony stamp <[email protected]> wrote:
>
> I'm not sure that's right - i thought the AjaxContext would handle that, and
> besides, that means i'd have to place conditionals inside each action to see
> if the request came from an XHR - if so, disable rendering, if not, carry on
> as normal. Isn't AjaxContext supposed to be transparent?
>
>
>
> Daniel Latter-2 wrote:
>>
>> You need to call setNoRender(true) of the viewRenderer helper inside
>> your action.
>>
>>
>> On 1 Nov 2009, at 13:13, tony stamp <[email protected]> wrote:
>>
>>>
>>> I have been having some trouble obtaining the html view rendered by
>>> an action
>>> from an AJAX request. Initially, in my ajax-ed controller action, i
>>> was
>>> checking if the request was XmlHttpRequest, and if so, disabling the
>>> layout
>>> so just the portion of the view is returned. This was not working,
>>> so a
>>> little research found pointers towards the AjaxContext helper. I
>>> have set it
>>> up as follows:
>>>
>>> Controller:
>>> public function init(){
>>>            parent::init();
>>>            $this->flashMessenger = $this->getHelper('FlashMessenger');
>>>
>>>            $ajaxContext = $this->_helper->getHelper('AjaxContext');
>>>            $ajaxContext->addActionContext('view', 'html')
>>>                        ->initContext();
>>>        }
>>>
>>> public function viewAction(){
>>>            if(!($id = $this->getRequest()->getParam('newsID'))){
>>>                $this->_redirect('index');
>>>            }
>>>
>>>            $newsTable = new News_Table();
>>>            $select = $newsTable->select();
>>>            $select->setIntegrityCheck(false);
>>>            $select->from('news')->joinLeft('news_approved',
>>>                                             'news.id =
>>> news_approved.news_id',
>>>                                             array('approver_id' =>
>>> 'staff_id', 'date_approved'));
>>>            $select->where('id = ?',(int) $id);
>>>
>>>            $rowset = $newsTable->fetchAll($select);
>>>            $this->view->assign('news', $rowset->current());
>>>        }
>>>
>>> The view script rendered for this is called view.phtml, so as per the
>>> documentation, i copied the content and named a new view script
>>> view.ajax.phtml.
>>>
>>> Although the correct action is being called (from jquery, with
>>> format=html
>>> appended to the query string, although it would be nice to assume
>>> that no
>>> format parameter = html by default, unless this can be set
>>> somewhere?) and
>>> loading the correct ajax view script, it is not disabling the
>>> layout, and i
>>> am getting a "page within a page".
>>>
>>> Any pointers on what i'm doing wrong?
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Returning-HTML-content-from-AjaxContext-tp26148891p26148891.html
>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Returning-HTML-content-from-AjaxContext-tp26148891p26156668.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Reply via email to