Is it possible to have a binding that combines more than one key path?

Lets say that I have an object that has a quantity value.

Also, I have an array controller that contains an array of these objects.

Also, I have a table that has a percentage of the total column (i.e. a given number of rows as a percentage of the sum of the values ​​for all rows) that needs to be populated with the proper value through the bindings.

Then it would seem that the idea to do this is to bind this column to arrayController.arrangedObjects. @ sum.quantity divided by arrayController.arrangedObjects.quantity.

Can this be done?

If not, can you suggest an alternative means of achieving this same goal?

0


a source to share


1 answer


One way would be to implement a custom number format, with a custom binding for the divisor, programmatically linked to arrayController.arrangedObjects.quantity

. In the formatter method, setObjectValue:

you have to do the division and pass the result by super

.



+1


a source







All Articles