Show ":N" association in Table as a column

Hi,

i sometimes have the case, that i want to show a CSV list of a relationship within a parent table.
An example of this would be: Customer --(Composition)–> Order
Then in the Customer browse screen i want to have a column “orders”, that does a CSV list of all the addresses. I know of the fact that ordering will not going to work properly, but that’s ok…

Unfortunately CUBA shows me a (for programmers understandable but not very fancy list of objects) of orders (see attached screenshot).

For the “addresses” field of the customer i fixed it myself. Would it be possible to get this behavior by default?
Attached you’ll find the project that shows the example and the solution with the Formatter class:


class InstanceNameCsvFormatter implements Formatter{
    @Override
    String format(Object value) {
        def instanceNames = value*.instanceName
        instanceNames?.sort().join(", ")
    }
}

That would be great.

Bye,
Mario

association-in-table

cuba-problem-table-association-csv.zip (90.7K)

Hi Mario,

It makes sense, we’ll do it.

Hi,

great, thanks!

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-8107