MIGX rich text formatting has disappeared since upgrade to MODX 3.0.1-pl

I’ve updated a client’s site from 2.8.3-pl to 3.0.1-pl and have noticed that rich text fields no longer render with their rich text formatting in the grid columns. Not a big issue, but can be confusing for clients to see html code in there when they didn’t before. Is there something I can change in the grid columns set up to restore the rich text formatting?

Here are before and after screenshots as well as my current grid columns code.


[
{
“header”: “Name”,
“width”: “50”,
“sortable”: “true”,
“dataIndex”: “name”
},{
“header”: “Job title”,
“width”: “50”,
“sortable”: “true”,
“dataIndex”: “job-title”
},{
“header”: “Email address”,
“width”: “50”,
“sortable”: “true”,
“dataIndex”: “email-address”
},{
“header”: “Biography”,
“width”: “100”,
“sortable”: “true”,
“dataIndex”: “biography”
}, {
“header”: “Image”,
“width”: “100”,
“sortable”: “false”,
“dataIndex”: “image”,
“renderer”: “this.renderImage”
}]

Could you create an issue on the github repo for that, please?
So I can try to reproduce it, as soon, as I have time.

I see the same issue on a fresh 3.0.1-pl install with MIGX 3.0.0-alpha5

Setting the richtext column’s renderer to this.renderFirst seems to fix it for me.

1 Like

That fixes it for me too, thanks @dejaya – you’re on fire! :grinning:

Just so I know for future in case it’s useful, what is the renderFirst renderer actually doing?

Yep good shout - I’ve no idea if there might be other implications of using it!

@bruno17 ?

Is there any other solution to this? Adding this.renderFirst fixes the problem with the rich text, but it also adds an “edit” icon for me in places that don’t make sense.

All the renderFirst renderer does, is to split the value at the character : and return the first part.

This shouldn’t add any “edit” icons.

I applied this.renderFirst and it was OK. But I added a link in richtext and there was a problem. You can’t save the MIGX template variable in while editing the document. An error appears:

image

How to fix it? Obviously I can remove this.renderFirst but then you can see the unformatted richtext code in the column.
image

That’ll be because links contain a colon :

Try using this.renderImageFromHtml instead.

None of these are right really - as it should render with no renderer selected [or at least it did in MODX 2.x] - but I can usually find a renderer that will show what I want.

You can also create a custom renderer - @halftrainedharry had some ideas here.

1 Like

Super, your idea works. Thanks a lot for your help!

1 Like