Can't edit row in MIGX — javascript errors

When right-clicking a row in a MIGX table and selecting “edit”, nothing happens. I get the following javascript errors:

Uncaught TypeError: Cannot read properties of undefined (reading ‘data’)
at MODx.grid.multiTVgrid37.loadWin (?a=resource/update&id=76:1626)
at MODx.grid.multiTVgrid37.update (?a=resource/update&id=76:1330)
at h.Event.fire (ext-all.js:21)
at S.fireEvent (ext-all.js:21)
at S.onClick (ext-all.js:21)
at S.onClick (ext-all.js:21)
at HTMLUListElement.I (ext-all.js:21)

I can create a new row just fine, and it shows up in the grid. I can’t edit, duplicate, or remove a row.

What could be causing this? It’s in a site that has been working fine for years. Now running MODX 2.8.3, MIGX 2.13.0, PHP 7.3.

I’m not sure exactly when this happened, since I haven’t edited the resources that use the MIGX field for over a year, and several MODX and extras upgrades have been applied in the meantime.


UPDATE:
I discovered that if I uncheck ALL the options for Contextmenus, Columnbuttons, and Actionbuttons, then the Edit link works. If I specify a subset of the Contextmenus, then editing stops working, even if I check off all the options.

I checked off a subset of Contextmenus back when I set up this site, and it was working. So at some point in updating MIGX, something changed.

Was trying to reproduce that issue, but its working for me.
Could you post your MIGX config, please

I get a (similar) JS error if I (mistakenly) check the checkbox update in the “Contextmenues”-tab instead of edit_migx. Maybe that is the problem.

Here it is:

{
  "formtabs":[
    {
      "MIGX_id":2,
      "caption":"Image Settings",
      "print_before_tabs":"0",
      "fields":[
        {
          "MIGX_id":2,
          "field":"title",
          "caption":"Title",
          "inputTV":"",
          "inputTVtype":"",
          "configs":"",
          "pos":1
        },
        {
          "MIGX_id":3,
          "field":"image",
          "caption":"Image",
          "description":"",
          "description_is_code":"0",
          "inputTV":"",
          "inputTVtype":"image",
          "validation":"",
          "configs":"",
          "restrictive_condition":"",
          "display":"",
          "sourceFrom":"config",
          "sources":"",
          "inputOptionValues":"",
          "default":"",
          "useDefaultIfEmpty":"0",
          "pos":2
        },
        {
          "MIGX_id":6,
          "field":"imageborder",
          "caption":"",
          "description":"",
          "description_is_code":"0",
          "inputTV":"",
          "inputTVtype":"checkbox",
          "validation":"",
          "configs":"",
          "restrictive_condition":"",
          "display":"",
          "sourceFrom":"config",
          "sources":"",
          "inputOptionValues":"Add Border==1",
          "default":"0",
          "pos":3
        },
        {
          "MIGX_id":7,
          "field":"download",
          "caption":"Download file",
          "description":"",
          "description_is_code":"0",
          "inputTV":"",
          "inputTVtype":"file",
          "validation":"",
          "configs":"",
          "restrictive_condition":"",
          "display":"",
          "sourceFrom":"config",
          "sources":[
            {
              "MIGX_id":2,
              "context":"web",
              "sourceid":3
            }
          ],
          "inputOptionValues":"",
          "default":"",
          "pos":4
        },
        {
          "MIGX_id":8,
          "field":"url",
          "caption":"URL",
          "description":"",
          "description_is_code":"0",
          "inputTV":"",
          "inputTVtype":"text",
          "validation":"",
          "configs":"",
          "restrictive_condition":"",
          "display":"",
          "sourceFrom":"config",
          "sources":"",
          "inputOptionValues":"",
          "default":"",
          "useDefaultIfEmpty":"0",
          "pos":5
        },
        {
          "MIGX_id":12,
          "field":"alternate_link",
          "caption":"Popup Link",
          "description":"If you want something other than the full-sized jpg to load in the slide show, select it here.",
          "description_is_code":"0",
          "inputTV":"",
          "inputTVtype":"file",
          "validation":"",
          "configs":"",
          "restrictive_condition":"",
          "display":"",
          "sourceFrom":"config",
          "sources":[
            {
              "MIGX_id":1,
              "context":"web",
              "sourceid":1
            }
          ],
          "inputOptionValues":"",
          "default":"",
          "pos":6
        },
        {
          "MIGX_id":13,
          "field":"imagescale",
          "caption":"Scale (100 is standard size)",
          "description":"If this image size is different from the standard height, enter the percentage here",
          "description_is_code":"0",
          "inputTV":"",
          "inputTVtype":"number",
          "validation":"",
          "configs":"",
          "restrictive_condition":"",
          "display":"",
          "sourceFrom":"config",
          "sources":"",
          "inputOptionValues":"",
          "default":"",
          "pos":7
        },
        {
          "MIGX_id":15,
          "field":"nopopup",
          "caption":"Popups",
          "description":"",
          "description_is_code":"0",
          "inputTV":"",
          "inputTVtype":"checkbox",
          "validation":"",
          "configs":"",
          "restrictive_condition":"",
          "display":"",
          "sourceFrom":"config",
          "sources":"",
          "inputOptionValues":"Don\u2019t include in popups==1",
          "default":"",
          "useDefaultIfEmpty":"0",
          "pos":8
        }
      ],
      "pos":1
    },
    {
      "MIGX_id":3,
      "caption":"Description",
      "print_before_tabs":"0",
      "fields":[
        {
          "MIGX_id":5,
          "field":"description",
          "caption":"Description",
          "description":"",
          "description_is_code":"0",
          "inputTV":"",
          "inputTVtype":"richtext",
          "validation":"",
          "configs":"",
          "restrictive_condition":"",
          "display":"",
          "sourceFrom":"config",
          "sources":"",
          "inputOptionValues":"",
          "default":"",
          "useDefaultIfEmpty":"0",
          "pos":1
        }
      ],
      "pos":2
    }
  ],
  "contextmenus":"",
  "actionbuttons":"",
  "columnbuttons":"",
  "filters":"",
  "extended":{
    "migx_add":"Add Image",
    "disable_add_item":"",
    "add_items_directly":"",
    "formcaption":"",
    "update_win_title":"",
    "win_id":"",
    "maxRecords":"",
    "addNewItemAt":"bottom",
    "media_source_id":"",
    "multiple_formtabs":"",
    "multiple_formtabs_label":"",
    "multiple_formtabs_field":"",
    "multiple_formtabs_optionstext":"",
    "multiple_formtabs_optionsvalue":"",
    "actionbuttonsperrow":4,
    "winbuttonslist":"cancel||done",
    "extrahandlers":"",
    "filtersperrow":4,
    "packageName":"",
    "classname":"",
    "task":"",
    "getlistsort":"",
    "getlistsortdir":"",
    "sortconfig":"",
    "gridpagesize":"",
    "use_custom_prefix":"0",
    "prefix":"",
    "grid":"",
    "gridload_mode":1,
    "check_resid":1,
    "check_resid_TV":"",
    "join_alias":"",
    "has_jointable":"no",
    "getlistwhere":"",
    "joins":"",
    "hooksnippets":"",
    "cmpmaincaption":"",
    "cmptabcaption":"",
    "cmptabdescription":"",
    "cmptabcontroller":"",
    "winbuttons":"",
    "onsubmitsuccess":"",
    "submitparams":""
  },
  "permissions":{
    "apiaccess":"",
    "view":"",
    "list":"",
    "save":"",
    "create":"",
    "remove":"",
    "delete":"",
    "publish":"",
    "unpublish":"",
    "viewdeleted":"",
    "viewunpublished":""
  },
  "fieldpermissions":"",
  "columns":[
    {
      "MIGX_id":2,
      "header":"Title",
      "dataIndex":"title",
      "width":"",
      "sortable":"false",
      "show_in_grid":1,
      "customrenderer":"",
      "renderer":"",
      "clickaction":"selectFromGrid",
      "selectorconfig":"this.update",
      "renderchunktpl":"",
      "renderoptions":"",
      "editor":""
    },
    {
      "MIGX_id":11,
      "header":"Image",
      "dataIndex":"image",
      "width":"",
      "sortable":"false",
      "show_in_grid":1,
      "customrenderer":"",
      "renderer":"this.renderImage",
      "clickaction":"",
      "selectorconfig":"",
      "renderchunktpl":"",
      "renderoptions":"",
      "editor":""
    },
    {
      "MIGX_id":9,
      "header":"Scale",
      "dataIndex":"imagescale",
      "width":30,
      "sortable":"false",
      "show_in_grid":1,
      "customrenderer":"",
      "renderer":"",
      "clickaction":"",
      "selectorconfig":"",
      "renderchunktpl":"",
      "renderoptions":"",
      "editor":""
    },
    {
      "MIGX_id":5,
      "header":"Download",
      "dataIndex":"download",
      "width":"",
      "sortable":"false",
      "show_in_grid":1,
      "renderer":"",
      "clickaction":"",
      "selectorconfig":"",
      "renderchunktpl":"",
      "renderoptions":""
    },
    {
      "MIGX_id":10,
      "header":"Description",
      "dataIndex":"description",
      "width":"",
      "sortable":"false",
      "show_in_grid":1,
      "customrenderer":"",
      "renderer":"",
      "clickaction":"",
      "selectorconfig":"",
      "renderchunktpl":"",
      "renderoptions":"",
      "editor":""
    },
    {
      "MIGX_id":7,
      "header":"URL",
      "dataIndex":"url",
      "width":"",
      "sortable":"false",
      "show_in_grid":1,
      "customrenderer":"",
      "renderer":"",
      "clickaction":"",
      "selectorconfig":"",
      "renderchunktpl":"",
      "renderoptions":"",
      "editor":""
    },
    {
      "MIGX_id":6,
      "header":"Sort",
      "dataIndex":"pos",
      "width":"",
      "sortable":true,
      "show_in_grid":"0",
      "renderer":"",
      "clickaction":"",
      "selectorconfig":"",
      "renderchunktpl":"",
      "renderoptions":""
    }
  ],
  "category":""
}

Ah. Yes, that’s it. “edit_migx” does what I want. So, what is “update” for?

OK, so is there a list somewhere of all the Contextmenu items and what they do?

Also, just noticed that there are these two options:

movetotop_migx
movetotop_bottom

The first one makes sense, but the second one doesn’t! I think it should be “movetobottom_migx”, yes?

Also, what’s the difference between “remove_migx” and “remove_migx_and_image”?

And wouldn’t “_row” make more sense than “_migx” for these values (e.g., “remove_row”)?

Also, “addbefore” and “addafter” don’t have “_migx” on the end of them, but they operate on rows just like settings with “_migx” do. The inconsistencies make it a little hard to grasp what these all do without researching.

I believe this is what you use for MIGXdb.

As far as I can tell, “remove_migx_and_image” also deletes the referenced image file from the disk. (The media source needs a property migxFileFieldname though, to define the name of the image field).

1 Like

well, that’s how inconsitency grows over time sometimes. But renaming them now, would break existing configs.