Actions dropdown too far right in Admin Listing
-
16-04-2021 - |
Pregunta
I've managed to add a second action to the actions column in the admin product listing. It works fine until I add another column to the display. The dropdown menu doesn't "follow" the actions column and stays on the right :
Is there any way to fix this ? I'm running Magento 2.3.3
EDIT
Here's my code
etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<!-- Plugin that adds an action to the default admin panel product listing -->
<type name="Magento\Catalog\Ui\Component\Listing\Columns\ProductActions">
<plugin name="pluginname" type="Vendor\Module\Plugins\AddStatsActionToProductListing" sortOrder="1" disabled="false" />
</type>
</config>
Plugin Class
public function afterPrepareDataSource(\Magento\Catalog\Ui\Component\Listing\Columns\ProductActions $subject, $result)
{
foreach ($result['data']['items'] as &$item) {
$item[$subject->getData('name')]['stats'] = [
'href' => $this->_urlBuilder->getUrl(
'vendor_module/groups_perproduct/index',
['product_id' => $item['entity_id']]
),
'label' => __('Stats'),
'hidden' => false,
'__disableTmpl' => true
];
}
return $result;
}
Solución
I checked the code, the Action
column seems be meant to be the last column.
The reason you have this is because the list actions, <ul>
tag is positioned absolute, whereas the closest relative element is .admin__data-grid-outer-wrap
, so the ul
's position will be aligned with that relative element.
No matter what the last column is, the ul
will always be there, at that specific position
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange