MIGX custom renderer changing field value?

I have a nested MIGX TV which gets its fields from a migxdb config. One of the fields is a dropdown TV courseId which gets me a list of entries from a custom table and saves the ID. So far, everything is working fine and I can save the selected ID.

Now I wanted to display the actual name of that entry in the columns view and not just the ID by setting up a custom renderChunk, also inside the MIGX CMP:

[[migxLoopCollection?
  &packageName=`courses`
  &classname=`Course`
  &tpl=`renderCourseTitle`    // [[+name]]
  &where=`{"id": "[[+courseId]]"}`]]

Now, when I select an entry and hit save the actual name is displayed like I want it to. However when I Save and Close to get a level higher in the nested TV and then go back in again, the field is blank.

To my surprise it seems like the actual value (the ID) which was saved is gone now. I thought that the renderChunk was just for display in the columns? It does break my frontend though, which relies on the ID, so I’m not sure where my mistake is here.

My guess is that you have to set the “Field” value of the column with the renderChunk (“dataIndex” in the JSON config) to a value that isn’t an existing column-name of the database table.

Meaning: Don’t use courseId as this column’s “Field” value.


If this doesn’t work then maybe post your complete JSON config here, so it’s possible to reproduce the issue.

Thank you, I forgot about that! I always find this a bit confusing, as in my thinking the field value of the column should match the formtabs field value, because it is supposed to display/interpret that value?

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.