i have a grid in which i display data from a DataProvider. The issue is when i click on a row, it returns the following javascript issue:

actions.js:216 Uncaught TypeError: Cannot read property 'index' of undefined
    at UiClass._getCallback (actions.js:216)
    at UiClass.applyAction (actions.js:156)
    at registry.js:59
    at Registry._resolveRequest (registry.js:418)
    at Registry._addRequest (registry.js:385)
    at Registry.get (registry.js:229)
    at async (registry.js:58)
    at column.js:291
    at UiClass.applySingleAction (column.js:253)
    at UiClass.applyFieldAction (column.js:228)

I assume something's wrong with either the configuration of the grid, of the columns or the actionsColumn.

The code for my grid is the following:

<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">my_grid.my_grid_data_source</item>
            <item name="deps" xsi:type="string">my_grid.my_grid_data_source</item>
        <item name="spinner" xsi:type="string">my_columns</item>


    <columns name="my_columns">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="childDefaults" xsi:type="array">
                    <item name="fieldAction" xsi:type="array">
                        <item name="provider" xsi:type="string">my_grid.my_grid.my_columns.actions</item>
                        <item name="target" xsi:type="string">applyAction</item>
                        <item name="params" xsi:type="array">
                            <item name="0" xsi:type="string">view</item>
                            <item name="1" xsi:type="string">${ $.$data.rowIndex }</item>


        <actionsColumn name="actions" class="Company\Module\Ui\Component\Listing\Column\MyActions">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="resizeEnabled" xsi:type="boolean">false</item>
                    <item name="resizeDefaultWidth" xsi:type="string">100</item>
                    <item name="viewUrlPath" xsi:type="string">*/*/edit</item>
                    <item name="urlEntityParamName" xsi:type="string">id</item>
                    <item name="indexField" xsi:type="string">id</item>
                    <item name="sortOrder" xsi:type="number">200</item>

and in MyActions class i have the following:

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


Any idea what am i missing?

  • What is name of primary key in DB? – Ankit Mar 29 at 11:35
  • Hello @Ankit, the primary key field is "id" – Robert Mar 29 at 11:39

You don't have indexField in your XML, this field helps initialize the actions array. I suggest you copy from Magento's core modules (any) and modify it instead of writing your own.

Link example to cms module: https://github.com/magento/magento2/blob/81672a278634e59965d2694e8f9107abf104ab14/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml#L188

  • Hello Jimmy, i actually do have the indexField, it's <item name="indexField" xsi:type="string">id</item> – Robert Mar 30 at 6:42
  • My bad. Everything looks ok to me. For situation like this, I always debug the JS to check why the error happen. – Jimmy Mar 30 at 6:48

I actually figured it out, i needed to add a column with the "id" field in the grid. After this, it works fine.

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.