0

When I click anywhere on the Grid I get the following:

enter image description here enter image description here enter image description here Actions xml:

...
<actionsColumn name="actions" class="Vendor\Module\Ui\Component\Listing\Grid\Column\BlogAction">
      <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="indexField" xsi:type="string">blog_id</item>
           </item>
      </argument>
 </actionsColumn>
 ...

BlogAction:

<?php

namespace Vendor\Module\Ui\Component\Listing\Grid\Column;

use Magento\Framework\UrlInterface;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Ui\Component\Listing\Columns\Column;

class BlogAction extends Column
{
    const URL_PATH_EDIT = 'vendor/blog/edit';


    protected $urlBuilder;
    protected $_storeManager;

    public function __construct(
        ContextInterface $context,
        UiComponentFactory $uiComponentFactory,
        UrlInterface $urlBuilder,
        array $components = [],
        array $data = []
    ) {
        $this->urlBuilder = $urlBuilder;
        parent::__construct($context, $uiComponentFactory, $components, $data);
    }


    public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items'])) {
            foreach ($dataSource['data']['items'] as &$item) {
                if (isset($item['blog_id'])) {
                    $item[$this->getData('name')] = [
                        'edit' => [
                            'href' => $this->urlBuilder->getUrl(
                                static::URL_PATH_EDIT,
                                [
                                    'blog_id' => $item['blog_id']
                                ]
                            ),
                            'label' => __('Edit')
                        ]
                    ];
                }
            }
        }
        return $dataSource;
    }
}

It seem that it's related to the actionsColumn as if I remove the xml then on click grid no error happen. I just can't figure it out what I am missing some sort of registry perhaps?

Anyone have any idea?

0

Ok found where the actual problem comes from and why the error occur.

It comes form inlineEdit editor config within columns I comment it out and the error is gone

e.g

...
<argument name="data" xsi:type="array">
  <item name="config" xsi:type="array">
    <item name="editorConfig" xsi:type="array">
        <item name="selectProvider" xsi:type="string">vendor_blog_grid_index.vendor_blog_grid_index.vendor_blog_grid_columns.ids</item>
        <item name="enabled" xsi:type="boolean">true</item>
        <item name="indexField" xsi:type="string">blog_id</item>
    </item>
    <item name="editor" xsi:type="array">
        <item name="editorType" xsi:type="string">text</item>
        <item name="validation" xsi:type="array">
            <item name="required-entry" xsi:type="boolean">true</item>
        </item>
    </item>
    <item name="storageConfig" xsi:type="array">
        <item name="provider" xsi:type="string">vendor_blog_grid_index.vendor_blog_grid_index.listing_top.bookmarks</item>
        <item name="namespace" xsi:type="string">current</item>
    </item>
    <item name="childDefaults" xsi:type="array">
        <item name="fieldAction" xsi:type="array">
            <item name="provider" xsi:type="string">vendor_blog_grid_index.vendor_blog_grid_index.vendor_blog_grid_columns.actions</item>
            <item name="target" xsi:type="string">startEdit</item>
            <item name="params" xsi:type="array">
                <item name="0" xsi:type="string">edit</item>
                <item name="1" xsi:type="string">${ $.$data.rowIndex }</item>
            </item>
        </item>
        <item name="storageConfig" xsi:type="array">
            <item name="provider" xsi:type="string">vendor_blog_grid_index.vendor_blog_grid_index.listing_top.bookmarks</item>
            <item name="root" xsi:type="string">columns.${ $.index }</item>
            <item name="namespace" xsi:type="string">current.${ $.storageConfig.root}</item>
        </item>
    </item>
</item>

...

Somewhere in here there's something not quite right!

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.