Skip to main content
deleted 2 characters in body
Source Link

I think you can overrideextend Magento/Ui/view/base/web/templates/grid/cells/actions.html. Second solution, you can add a new column action for test like

<actionsColumn name="test_actions" class="Space\YourModule\Ui\Component\Listing\Column\TestAction">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
            <item name="indexField" xsi:type="string">id</item>
            <item name="sortable" xsi:type="boolean">false</item>
            <item name="label" xsi:type="string" translate="true">Test Action</item>
            <item name="urlEntityParamName" xsi:type="string">id</item>
        </item>
    </argument>
</actionsColumn>

And with class Space\YourModule\Ui\Component\Listing\Column\TestAction in prepareDataSource, we have :

$url = $this->urlBuilder->getUrl(
    'test_action',
    ['id' => $item['id']]
);

$html = '<a href="'. $url.'" target="_blank">
<button class="action-scalable action-default scalable">Test</button></a>';
$item[$this->getData('name')] = $html;

I think you can override Magento/Ui/view/base/web/templates/grid/cells/actions.html. Second solution, you can add a new column action for test like

<actionsColumn name="test_actions" class="Space\YourModule\Ui\Component\Listing\Column\TestAction">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
            <item name="indexField" xsi:type="string">id</item>
            <item name="sortable" xsi:type="boolean">false</item>
            <item name="label" xsi:type="string" translate="true">Test Action</item>
            <item name="urlEntityParamName" xsi:type="string">id</item>
        </item>
    </argument>
</actionsColumn>

And with class Space\YourModule\Ui\Component\Listing\Column\TestAction in prepareDataSource, we have :

$url = $this->urlBuilder->getUrl(
    'test_action',
    ['id' => $item['id']]
);

$html = '<a href="'. $url.'" target="_blank">
<button class="action-scalable action-default scalable">Test</button></a>';
$item[$this->getData('name')] = $html;

I think you can extend Magento/Ui/view/base/web/templates/grid/cells/actions.html. Second solution, you can add a new column action for test like

<actionsColumn name="test_actions" class="Space\YourModule\Ui\Component\Listing\Column\TestAction">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
            <item name="indexField" xsi:type="string">id</item>
            <item name="sortable" xsi:type="boolean">false</item>
            <item name="label" xsi:type="string" translate="true">Test Action</item>
            <item name="urlEntityParamName" xsi:type="string">id</item>
        </item>
    </argument>
</actionsColumn>

And with class Space\YourModule\Ui\Component\Listing\Column\TestAction in prepareDataSource, we have :

$url = $this->urlBuilder->getUrl(
    'test_action',
    ['id' => $item['id']]
);

$html = '<a href="'. $url.'" target="_blank">
<button class="action-scalable action-default scalable">Test</button></a>';
$item[$this->getData('name')] = $html;
deleted 2 characters in body
Source Link
sv3n
  • 11.7k
  • 7
  • 41
  • 73

I think you can override Magento/Ui/view/base/web/templates/grid/cells/actions.html. Second solution, you can add a new column action for test like

<actionsColumn name="test_actions" class="Space\YourModule\Ui\Component\Listing\Column\TestAction">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                <item name="indexField" xsi:type="string">id</item>
                <item name="sortable" xsi:type="boolean">false</item>
                <item name="label" xsi:type="string" translate="true">Test Action</item>
                <item name="urlEntityParamName" xsi:type="string">id</item>
            </item>
        </argument>
    </actionsColumn>

And with class Space\YourModule\Ui\Component\Listing\Column\TestAction in prepareDataSource, we have :

$url = $this->urlBuilder->getUrl(
                        'test_action',
                        ['id' => $item['id']]
                    );
                   
$html = '<a href="'. $url.'" target="_blank">
<button class="action-scalable action-default scalable">Test</button></a>';
$item[$this->getData('name')] = $html;

I think you can override Magento/Ui/view/base/web/templates/grid/cells/actions.html. Second solution, you can add a new column action for test like

<actionsColumn name="test_actions" class="Space\YourModule\Ui\Component\Listing\Column\TestAction">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                <item name="indexField" xsi:type="string">id</item>
                <item name="sortable" xsi:type="boolean">false</item>
                <item name="label" xsi:type="string" translate="true">Test Action</item>
                <item name="urlEntityParamName" xsi:type="string">id</item>
            </item>
        </argument>
    </actionsColumn>

And with class Space\YourModule\Ui\Component\Listing\Column\TestAction in prepareDataSource, we have :

$url = $this->urlBuilder->getUrl(
                        'test_action',
                        ['id' => $item['id']]
                    );
                   
$html = '<a href="'. $url.'" target="_blank">
<button class="action-scalable action-default scalable">Test</button></a>';
$item[$this->getData('name')] = $html;

I think you can override Magento/Ui/view/base/web/templates/grid/cells/actions.html. Second solution, you can add a new column action for test like

<actionsColumn name="test_actions" class="Space\YourModule\Ui\Component\Listing\Column\TestAction">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
            <item name="indexField" xsi:type="string">id</item>
            <item name="sortable" xsi:type="boolean">false</item>
            <item name="label" xsi:type="string" translate="true">Test Action</item>
            <item name="urlEntityParamName" xsi:type="string">id</item>
        </item>
    </argument>
</actionsColumn>

And with class Space\YourModule\Ui\Component\Listing\Column\TestAction in prepareDataSource, we have :

$url = $this->urlBuilder->getUrl(
    'test_action',
    ['id' => $item['id']]
);

$html = '<a href="'. $url.'" target="_blank">
<button class="action-scalable action-default scalable">Test</button></a>';
$item[$this->getData('name')] = $html;
Source Link

I think you can override Magento/Ui/view/base/web/templates/grid/cells/actions.html. Second solution, you can add a new column action for test like

<actionsColumn name="test_actions" class="Space\YourModule\Ui\Component\Listing\Column\TestAction">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                <item name="indexField" xsi:type="string">id</item>
                <item name="sortable" xsi:type="boolean">false</item>
                <item name="label" xsi:type="string" translate="true">Test Action</item>
                <item name="urlEntityParamName" xsi:type="string">id</item>
            </item>
        </argument>
    </actionsColumn>

And with class Space\YourModule\Ui\Component\Listing\Column\TestAction in prepareDataSource, we have :

$url = $this->urlBuilder->getUrl(
                        'test_action',
                        ['id' => $item['id']]
                    );
                   
$html = '<a href="'. $url.'" target="_blank">
<button class="action-scalable action-default scalable">Test</button></a>';
$item[$this->getData('name')] = $html;