0

Need to align the title of the column(header_css_class) and content(align) dynamically of return of a method.

I tried like this in after calling a methodo and failed.

Example:

<?xml version="1.0"?>
<layout>
    <sales_order_grid_update_handle>
        <reference name="sales_order.grid">
            <action method="addColumnAfter" ifconfig="dexxtz_customgrid/general/active">
                <columnId>payment_method</columnId>
                <arguments>
                    <header>Payment Method</header>
                    <index>payment_method</index>
                    <header_css_class>a-center</header_css_class>-->
                    <align>center</align>
                    <filter_index>payment.method</filter_index>
                    <type>text</type>
                    <width>100px</width>
                </arguments>
                <after helper="customgrid/getAfter" />
            </action>
        </reference>
    </sales_order_grid_update_handle>
    <adminhtml_sales_order_grid>
        <update handle="sales_order_grid_update_handle" />
    </adminhtml_sales_order_grid>
    <adminhtml_sales_order_index>
        <update handle="sales_order_grid_update_handle" />
    </adminhtml_sales_order_index>
</layout>

1 Answer 1

0

Answer:

Modified the arguments calling a function from my helper.

Example layout.xml

<?xml version="1.0"?>
<layout>
    <sales_order_grid_update_handle translate="label" module="dexxtz_customgrid">
        <reference name="sales_order.grid">
            <action method="addColumnAfter" ifconfig="dexxtz_customgrid/general/active">
                <columnId>payment_method</columnId>
                <arguments helper="customgrid/getPaymentColumnParams" />
                <after helper="customgrid/getAfter" />
            </action>
        </reference>
    </sales_order_grid_update_handle>
    <adminhtml_sales_order_grid>
        <update handle="sales_order_grid_update_handle" />
    </adminhtml_sales_order_grid>
    <adminhtml_sales_order_index>
        <update handle="sales_order_grid_update_handle" />
    </adminhtml_sales_order_index>
</layout>

Example helper:

class Dexxtz_Customgrid_Helper_Data extends Mage_Core_Helper_Abstract
{
    public function getPaymentColumnParams(){
        return array('header' => 'Payment Method',
                     'index' => 'payment_method',
                     'filter_index' => 'payment.method',
                     'header_css_class' => 'a-center',
                     'align' => 'center',
                     'type' => 'text',
                     'width' => '100px');
    }
}
2
  • Please mark this as accepted.
    – Marius
    Nov 13, 2014 at 7:16
  • 1
    I need wait more 1 day @Marius
    – Dexxtz
    Nov 13, 2014 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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