I have a requirement to group/categorize column headings of a grid layout which will result in 2-level column heading.

For example,let we have 5 columns in a grid named as : First Name,Last Name,Email,Company,Designation .....Now,I want to group/categorize them in "Personal Info" and "Professional Info" by adding these two top level headings.

So,Under "Personal Info" heading I will have 3 columns with headings - First Name,Last Name,Email and under "Professional Info" heading I will have Company and Designation headings....Can I achieve this ??If yes,then can anybody help me to find out how can I do this???


This is not supported by default in magento.
There is the code that renders the headers in a grid (code from app/design/adminhtml/default/default/template/widget/grid.phtml)

<?php if ($this->getHeadersVisibility()): ?>
    <tr class="headings">
    <?php foreach ($this->getColumns() as $_column): ?>
        <th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
    <?php endforeach; ?>
<?php endif; ?>

but here is my idea. Unfortunately I don't have a full functioning solution for it.

Use a different template for your custom grid.
You can clone the file I mentioned above and modify the clone.
You can tell your grid block to use the clone template by adding this


in the constructor of your grid block after calling parent::__construct.

Then you should change the code I mentioned to include an other <tr> element that will hold your column group labels.
This is where my idea stops. I don't know yet how you can manipulate the columns to make them use groups.

  • This is more than enough for me ,It will make my work.Thanks – Piyush Rathi Nov 14 '14 at 12:32

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.