1

I want to load my grid class within constructor method of other block.I try this peace of code but don't succeed.

`class Mymodule_Block_Adminhtml_Sales_Order_View_Tabs  extends 
    Mage_Adminhtml_Block_Sales_Order_Abstract
        implements Mage_Adminhtml_Block_Widget_Tab_Interface
    {

        protected $_chat = null;

        protected function _construct()
        {
            parent::_construct();
               $class = Mage::getConfig()->getBlockClassName('mymodule/adminhtml_mymodule_edit_tab_tickethistory');   
                $block = new $class;
               $block-> _prepareCollection();

        }
    } .

I can set phtml file here but my requirement is to load grid class.how can i do that ? Thanks in advance

1 Answer 1

3

You can load a block like this:

Mage::app()->getLayout()->createBlock('identifier/here');

in your case:

Mage::app()->getLayout()->createBlock('mymodule/adminhtml_mymodule_edit_tab_tickethistory');

but what you are trying to do won't work because _prepareCollection() is a protected method. You can only call it inside the class methods or it's descendants.
I think it's better to explain the problem you have, not the problems you have while implementing the solution. Maybe someone has a better idea on how to do it.

1
  • Thanks for your respons.If you look at my question (" stackoverflow.com/questions/17187278/… solve it .After that I face current problem that how can now load grid instead of phtml.Hope you got point Commented Jun 20, 2013 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.