0

I am trying to show a column in grid using renderer .

here is my renderer file

public function render(Varien_Object $row) 
{ 

    $value =  $row->getData($this->getColumn()->getIndex());
    $collection = Mage::getModel("manager/asmtracker")->load($row->getManagerId());
    $customerId = $collection->getManagerId();
    //$customer=Mage::getModel('customer/customer')->load($customerId);
    $city = Mage::getModel("manager/cities")->getCollection()
                                            ->addFieldToFilter('regionalmanager',array('id' => $customerId))
                                            ->getFirstItem();
    //$reg = Mage::getModel("customer/customer")->load($city->getManagerCity());


    return $city->getName();

}

also my grid.php is :

protected function _prepareColumns()
        {
                $this->addColumn("id", array(
                "header" => Mage::helper("manager")->__("ID"),
                "align" =>"right",
                "width" => "50px",
                "type" => "number",
                "index" => "id",
                ));  
                $this->addColumn("manager_id", array(
                "header" => Mage::helper("manager")->__("Manager ID"),
                "index" => "manager_id",
                ));
                $this->addColumn("manager_name", array(
                "header" => Mage::helper("manager")->__("Manager Name"),
                "index" => "manager_name",
                'renderer'  => 'Company_Manager_Block_Adminhtml_Renderer',
                ));
                $this->addColumn("manager_city", array(
                "header" => Mage::helper("manager")->__("City"),
                "index" => "manager_city",
                'renderer'  => 'Company_Manager_Block_Adminhtml_Renderercity',
                ));
                $this->addColumn("punch_in_time", array(
                "header" => Mage::helper("manager")->__("Punch In Time"),
                "index" => "punch_in_time",
                'type'      => 'datetime',
                //'renderer'  => 'Company_Manager_Block_Adminhtml_Rendererintime',
                ));
                $this->addColumn("punch_out_time", array(
                "header" => Mage::helper("manager")->__("Punch Out Time"),
                "index" => "punch_out_time",
                'type'      => 'datetime',
                //'renderer'  => 'Company_Manager_Block_Adminhtml_Rendereroutime',
                ));
                $this->addColumn("in_coordinates", array(
                "header" => Mage::helper("manager")->__("Punch In Location"),
                "index" => "in_coordinates",
                ));
                $this->addColumn("out_coordinates", array(
                "header" => Mage::helper("manager")->__("Punch Out Location"),
                "index" => "out_coordinates",
                ));
                $this->addColumn('create_at', array(
                    'header'    => Mage::helper('manager')->__('Created At'),
                    'index'     => 'create_at',
                    'type'      => 'datetime',
                ));

                    return parent::_prepareColumns();
    }
  • What is the error with your code? – Jaimin Sutariya Mar 7 '17 at 15:22
  • No error , its not taking value – supriya mishra Mar 7 '17 at 15:25
  • Try var_dump your variables and check where it's not getting values in your render function. – Jaimin Sutariya Mar 7 '17 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.