Rendering layouts
hen we do toHtml(), we render only single block, for example in Adminhtml sorting, when we click on field we want to render only single block not whole page
public function gridAction() { $this->loadLayout(); // $this->getResponse()->setBody( // $this->getLayout()->createBlock('storelocator/adminhtml_entity_grid')->toHtml() // ); // return $this; } |
but if we dont do toHtml() and follow with renderLayout() then it renders whole blocks of the page, like this:
public function indexAction() { $this->_initAction(); // $this->_addContent($this->getLayout()->createBlock('storelocator/adminhtml_entity')); // $this->renderLayout(); // return $this; } |