Jump to content


Photo

Truncate in listing doesn't work for Database Relationship fields


I have a field of type Database Relationship in a custom database.  In the database listing template I ask for the formatted value of the field, which should include any truncation if I'm not mistaken.  Even when i change the value of Truncate in listing from 0 to something else, the text displayed in the listing is not truncated.

Status: Fixed
Version: 2.3.2
Fixed In: 2.3.3


5 Comments

honour a character limit and/or a results num and do a tags-like more thing maybe? Just thinking out loud.
Updating Fixed In to: 2.3.3
Updating Status to: Fixed

Ok, I've fixed it to truncate single result relational fields (whether linked or not). It is very complicated to try to truncate multiple result relational fields (you'd have to try to remember how many chars were shown and sum that up as each item is shown to determine a break point), thus I'm not doing that for now.
That's great, and certainly the low-hanging fruit since one-to-one relationships are probably the most common. It sure would be nice if, in the future, you could revisit this and truncate the entire field in cases of one-to-many relationships. I like Marcher's idea of a tags-like "more" thing, but it might get too tricky. E.g. what if your first relationship is already longer than the truncation length. You'd have to have both a truncated text AND a "more", which might look silly. I suppose you could have two truncation lengths, one for each item in the list, and another for the entire list (or specify the number of items to show). I can see why you stopped where you did.
Yes, it gets tricky, especially since each individual item is a separate anchor tag (so you can't just truncate the entire string, which wouldn't be difficult - you'd have to truncate the string within separate anchor tags where it finally goes over the length which is much more difficult).
:P I like results num... sounds far more sensible to limit how many records are pulled/shown than attempt the string length hijinkery.