views:

13

answers:

0

I'm creating a Dashcode App that displays products that have won one or more awards.

The Data Source has a column/field for each award that the product may win (products may win multiple awards). The column has 'Y' if they won that award and is null if they didn't.

So I'm binding the column from the data source to an image object and then using a Value Transformer to set the correct src for the image if they won the award. This works fine and very little code is required. Just something like this:

myHasGoldAward = Class.create(DC.ValueTransformer,{
transformedValue: function(value){
    if (value == 'Y') {
        value = "Images/GoldAward.png";
}
    return value;
}

The wrinkle is that the column I'm binding to only indicates if they won a certain level award (ie. Gold, Silver, Bronze), but there's another column that indicates the type of product (ie. Book, Toy, Audio, Video). The logo for the award is different for each of the different types of products. The Gold Book award looks different than the Gold Toy award.

I need to be able to access the other column from within my Value Transformer in order to be able to set the right image for the Award.

Does anyone know the syntax to access another column in a data source from inside a value transformer?

Thanks!