जैसा कि अन्य उत्तरों ने इंगित किया है, आप इसे पूरा करने के लिए Mage_Adminhtml_Block_Widget_Grid::addColumnAfter
विधि का उपयोग कर सकते हैं।
हालांकि अन्य उत्तरों का उल्लेख करने में असफल रहा है कि कॉलम को को पुन: व्यवस्थित करने के लिए आपको स्पष्ट रूप से Mage_Adminhtml_Block_Widget_Grid::sortColumnsByOrder
पर कॉल करना होगा। इस प्रकार
Mage_Adminhtml_Block_Widget_Grid::sortColumnsByOrder
विधि Mage_Adminhtml_Block_Widget_Grid::_prepareColumns
विधि द्वारा विशेष रूप से कहा जाता है:
/// app/code/core/Mage/Adminhtml/Block/Widget/Grid.php line 557
protected function _prepareColumns()
{
$this->sortColumnsByOrder();
return $this;
}
इसका मतलब यह है कि आपके व्युत्पन्न वर्ग क्रम में अपने नए आदेश के आधार पर कॉलम फिर से सॉर्ट में भी ऐसा ही करना होगा। उदाहरण के लिए:
protected function _prepareColumns() {
/// Let the parent add some columns
/// Mage_Eav_Block_Adminhtml_Attribute_Grid_Abstract does add some
parent::_prepareColumns();
/// Add some new columns
$this->addColumnAfter('sort_order', array(
'header' => $this->__('Sort Order'),
'sortable' => true,
'index' => 'sort_order'
), 'frontend_label');
$this->addColumnAfter('attribute_group_name', array(
'header' => $this->__('Attribute Group'),
'sortable' => true,
'index' => 'attribute_group_name'), 'sort_order');
/// ! IMPORTANT ! Re-sort the columns with the new additions
$this->sortColumnsByOrder();
return $this;
}
स्रोत
2016-10-06 04:03:48
यह काम करता है। – jruzafa
देखें, माता-पिता से पहले इसे कॉल करने का आदेश महत्वपूर्ण हो सकता है, प्रफुल राजपूत – peedee