protected function _changeActionColumnToAjax(Mage_Index_Block_Adminhtml_Process_Grid $grid) { $grid->getColumn('action')->setActions(array(array('caption' => Mage::helper('index')->__('Reindex Data'), 'url' => array('base' => '*/*/reindexProcessAjax'), 'onclick' => "new IndexerStats.AjaxRequest(this); return false;", 'field' => 'process'))); /* * We use the IndexerStats.AjaxRequest class only for response here, normal Ajax.Request * is hard coded in grid.js as only non-submitting action * * eval'd "complete" value gets used as callback in JavaScript. */ $grid->getMassactionBlock()->setUseAjax(true)->getItem('reindex')->setUrl($grid->getUrl('*/*/massReindexAjax'))->setComplete('(rq = new IndexerStats.AjaxRequest()).onMassComplete.bind(rq)'); }
/** * Prepare grid columns */ protected function _prepareColumns() { $this->addColumn('started_at', array('header' => Mage::helper('index')->__('Started At'), 'type' => 'datetime', 'width' => '180', 'align' => 'left', 'index' => 'started_at', 'after' => 'update_required', 'renderer' => 'Aoe_Index_Block_Adminhtml_Grid_Column_Renderer_Datetime', 'frame_callback' => array($this, 'decorateDate'))); $this->_columnsOrder['started_at'] = 'update_required'; parent::_prepareColumns(); $this->getColumn('ended_at')->setData('ageBase', 'started_at'); $this->getColumn('ended_at')->setData('ageDescription', '(Took %s)'); $this->getColumn('ended_at')->setData('renderer', 'Aoe_Index_Block_Adminhtml_Grid_Column_Renderer_Datetime'); return $this; }
/** * Change action column to dropdown with additional actions * - schedule reindex * - schedule partial reindex * * @param Mage_Index_Block_Adminhtml_Process_Grid $grid * @return Hackathon_AsyncIndex_Model_Observer */ protected function _changeActions(Mage_Index_Block_Adminhtml_Process_Grid $grid) { $grid->getColumn('action')->setActions(array(array('caption' => Mage::helper('index')->__('Reindex Data'), 'url' => array('base' => '*/*/reindexProcess'), 'field' => 'process'), array('caption' => Mage::helper('index')->__('Schedule Reindex'), 'url' => array('base' => 'asyncindex/asyncindex/index'), 'params' => array('_current' => true, '_secure' => false), 'field' => 'process'), array('caption' => Mage::helper('index')->__('Schedule partial index'), 'url' => array('base' => 'asyncindex/asyncindex/schedulePartial'), 'params' => array('_current' => true, '_secure' => false), 'field' => 'process'))); return $this; }