Hi MODx fans,
If you’re like me, you have bunches of table data to display in columns and rows. We have the Datagrid Widget for that purpose, and it’s pretty cool.
A feature was added to it, Column Types, whose purpose was to format data in a column, for
bold and
italic and that sort of thing.
However, sometime ago folks were asking about using URL’s in there, because they tried it and didn’t get good links. The upshot is that the "equal sign" was getting clobbered, and this does matter in URL’s.

I’ll spare you the gory details, but I found some code that encodes and decodes the "equal sign", and I’m sure that this is highly useful for something. I’ll leave that to folks who enjoy the intricacies of character encoding.
I believe I’ve found a solution. For those of you who don’t mind editing some code, in
datagrid.class.php at around line 120, you’ll see the following lines. My patch is marked in
red. I prefer not to use hard-coded patches, but this one keeps the fix very small and doesn’t risk harming other code.
------------------------------------------
case "template":
// replace [+value+] first
// problem is ’=’ is being changed to ’%3D’ before it gets here.
$type_format = str_replace(’%3D’,’=’,$type_format);
$value = str_replace("[+value+]",$value,$type_format);
// replace other [+fields+]
if(strpos($value,"[+")!==false) foreach($row as $k=>$v){
$value = str_replace("[+$k+]",$v,$value);
}
break;
-------------------------------------------------
Reminder: In the Datagrid, you put code like the following into the Column Type. In the following example, my database field is enclosed by plus signs. Notice that I began the line with 2 commas. This is because I want the formatting in the third column, so I’m using the commas to skip the first two. I had a couple of goofs before I figured that out. Similar code can be used for email or other types of links.
,,template:<a href=’http://[+website+]’>[+website+]</a>
I hope you enjoy it! Samba
PS: I’ve also been getting excellent use out of Jason’s Maketable snippet for more flexible formatting.