MigxDb: can't get multiple render.ClickCrossTick working

I have two fields defined as render.ClickCrossTick in the overview of a MigxDb as shown in the screenshot.
The one with the fieldname “published” works as great. Clicking it’s green checkmark toggles to a red cross and vice versa.
However, the field “published_footer” ignores the clicks.

How can I get both fields working?

Looking at the code

it seems that the purpose of render.ClickCrossTick is indeed only to publish/unpublish an object (handler = 'this.publishObject' | handler = 'this.unpublishObject').

Maybe you can use this.renderSwitchStatusOptions instead. Fill out the “Renderoptions” (at the bottom of the form) and I believe you also have to activate this.handleColumnSwitch (in the tab “Handlers”) to make it work.

1 Like

that’s what I usually use for other fields, than published

Is there any documentation anywhere on what exactly one needs to do in MIGX to use “this.renderSwitchStatusOptions” for a click toggle with checkbox/ X?

I can’t find any guidance anywhere. Most googling of that term turns up a lot of Russian :slight_smile:

For anyone else looking, I found answers here:

https://docs.modx.com/3.x/en/extras/migx/migx.tutorials/using-grid-inline-editing

2 Likes

The method described in that tutorial:

Tab ‘Columns’ Create columns:

Header: “Checkbox” Field: “checkbox” Renderer: this.renderSwitchStatusOptions onClicK: switchOption

Add three RenderOptions:

name: checkbox_inactive value: 0 image: assets/components/migx/style/images/cb_empty.png
name: checkbox_active value: 1 image: assets/components/migx/style/images/cb_ticked.png
and as fallback for other values:
name: checkbox_fallback check the ckeckbox: ‘use as fallback’ value: image: assets/components/migx/style/images/cb_empty.png

at the Tab ‘Handlers’ check ‘this.handleColumnSwitch’

at the Tab ‘Formtabs’

Create a Tab with Caption ‘Fields’ Create field:

Fieldname: “checkbox” Caption: “Checkbox” input TV type: “checkbox” Input Option Values: “active==1” Default Value: 0

… seems to work great for MIGXdb CMPs - but it doesn’t seem to work when used on a MIGX TV (which is what the wider tutorial describes).

Tested on two sites. Clicking the :white_check_mark: or :x: just has no effect.

MODX 3.0.4 MIGX 3.0.2-beta1

Does anyone have this working? Or fancy testing the tutorial?

It does work in MODX 2.x.

It seems the problem is, that MODX 3 added a click-handler to the grid (for the :gear:column on the right side). This click handler overwrites the click-handler for the checkboxes.


Here is a possible way to fix this.
(There is probably a better way, but my Ext.js knowledge is quite limited.)

  • Rename this function to onClick (instead of onClickGrid)
  • Remove this line
  • Add the line showActionsColumn: false, somewhere around here to hide the :gear:column)

If you want to customize the grid (like described above), first copy the file to a custom folder → core/components/<package_name>/migxtemplates/mgr/grids.
Then in the MIGX config → tab “MIGXdb-Settings” → set “Package” to the value of <package_name> you used in the file path above, so that your custom grid gets used.

Ah thanks for checking that out Harry :+1:

As I mentioned - I’d got it to work OK on the MIGXdb CMP - then thought I’d submit a quick update of the documentation. It was only when I followed the full thing [creating a MIGX TV] that I realised it wasn’t working that way.

So no point updating the docs I guess!

Should I report this as a MIGX issue?

Thanks again for your help.