本文整理汇总了PHP中Mage_Adminhtml_Block_Widget_Grid::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Adminhtml_Block_Widget_Grid::getId方法的具体用法?PHP Mage_Adminhtml_Block_Widget_Grid::getId怎么用?PHP Mage_Adminhtml_Block_Widget_Grid::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Adminhtml_Block_Widget_Grid
的用法示例。
在下文中一共展示了Mage_Adminhtml_Block_Widget_Grid::getId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterGridPrepareCollection
public function afterGridPrepareCollection(Mage_Adminhtml_Block_Widget_Grid $grid)
{
$blockType = $grid->getType();
$blockId = $grid->getId();
if (!is_null($model = $this->_getGridModel($blockType, $blockId, true)) && !$model->getDisabled()) {
if ($grid->getCollection()) {
// Check grid model against grid columns
$grid->getCollection()->load();
$applyFromCollection = $model->checkColumnsAgainstGridBlock($grid);
// Apply it to grid block (only apply from collection if it could be checked)
$model->applyColumnsToGridBlock($grid, $applyFromCollection);
// Finish to prepare grid collection
$grid->blcg_finishPrepareCollection();
} else {
// If grid has no collection, check and apply directly
$model->checkColumnsAgainstGridBlock($grid);
$model->applyColumnsToGridBlock($grid, false);
}
}
}
示例2: initWithGridBlock
/**
* Init values with grid block instance
*
* @param Mage_Adminhtml_Block_Widget_Grid $grid Grid block instance
* @return this
*/
public function initWithGridBlock(Mage_Adminhtml_Block_Widget_Grid $grid)
{
// Init global grid values
$this->addData(array('block_id' => $grid->getId(), 'block_type' => $grid->getType()));
$this->_initTypeModel();
// Init columns
$this->resetColumns();
$order = 0;
$gridIndexes = array();
foreach ($grid->getColumns() as $column) {
// Take all columns from grid
$this->_addColumnFromBlock($column, ++$order * $this->getOrderPitch(), self::GRID_COLUMN_ORIGIN_GRID);
$gridIndexes[] = $column->getIndex();
}
if ($grid->getCollection() && $grid->getCollection()->count() > 0) {
// Initialize collection columns if possible
$item = $grid->getCollection()->getFirstItem();
foreach ($item->getData() as $key => $value) {
if (!in_array($key, $gridIndexes, true) && !in_array($key, $this->_originIds[self::GRID_COLUMN_ORIGIN_GRID], true) && (is_scalar($value) || is_null($value))) {
/*
From collection, only take columns that are not already used by grid,
and do not correspond to array / object / resource values
*/
$this->_addColumnFromCollection($key, ++$order * $this->getOrderPitch());
}
}
}
return $this;
}