0

i want to add a global select like 'Select one option' contains my all actions 'Renew' and 'View' , can anyone tell me how to do that ?

This is my code for now I have done some effort but 'Select one option' still not showing?

$this->addColumn(
                'action',
                [
                    'header' => 'Action',
                    'filter' => false,
                    'sortable' => false,
                    'width' => '100px',
                    'renderer' => \Magento\Sales\Block\Adminhtml\Reorder\Renderer\Action::class
                ]
            );
public function render(\Magento\Framework\DataObject $row)
    {
        $this->_actions = [];
        if ($this->_salesReorder->canReorder($row->getId())) {
            $tbltofill = [];
            $reorderAction = [
                'view' => [
                    'href' => $this->getUrl('sales/order/view', ['order_id' => $row->getId()]),
                    'label' => __('View'),
                ],
                'renew' => [
                    'href' => $this->getUrl('sales/order_create/reorder', ['order_id' => $row->getId()]),
                    'label' => __('Renew'),
                ]
            ];
            $tbltofill['Select one option'] = $reorderAction;
            $this->addToActions($tbltofill);
        }
        $this->_eventManager->dispatch(
            'adminhtml_customer_orders_add_action_renderer',
            ['renderer' => $this, 'row' => $row]
        );
        return $this->_actionsToHtml();
    }

1 Answer 1

1

Try this to replace and remove your renderer function

    $this->addColumn(
        'action',
        [
            'header' => __('Action'),
            'type' => 'action',
            'getter' => 'getId',
            'actions' => [
                [
                    'caption' => __('View'),
                    'url' => [
                        'base' => 'sales/order/view'
                    ],
                    'field' => 'order_id'
                ],
                [
                    'caption' => __('Renew'),
                    'url' => [
                        'base' => 'sales/order_create/reorder'
                    ],
                    'field' => 'order_id'
                ]
            ],
            'filter' => false,
            'sortable' => false,
            'index' => 'stores',
            'header_css_class' => 'col-action',
            'column_css_class' => 'col-action'
        ]
    );
5
  • than you , but i render the actions from this class ==> 'renderer' => \Magento\Sales\Block\Adminhtml\Reorder\Renderer\Action::class , not just from the addColumn Apr 1, 2020 at 9:08
  • remove this class replace this above code and check and update me.
    – Msquare
    Apr 1, 2020 at 9:24
  • in above code we not need this class \Magento\Sales\Block\Adminhtml\Reorder\Renderer\Action::class
    – Msquare
    Apr 1, 2020 at 9:30
  • but in my case i need it , should i change something in the "public function render" above? Apr 1, 2020 at 14:35
  • Using above code you don't need to use "public function render"
    – Msquare
    Apr 1, 2020 at 15:44

Your Answer

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

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