Have imageUrlExpression in CLinkColumn

In CLinkColumn there’s the very useful urlExpression and labelExpression. They are very useful since they are evaluated at runtime, in context of the specific record(=model object) handled at that iteration (when building a grid for example, with CGridView).

What I’m missing is the same dynamic capability for imageUrl property. I’m rendering an “articles” table where each article has its category. Categories are stored in another table and relationship is defined. Everything works fine with evaluation of “this” article’s category name, which is used dynamically with labelExpression, but I cannot do the same for the category’s icon. For that, I need this capability.

This thread is therefore to request such a feature: have something like imageUrlExpression that will be used in much the same way as labelExpression.

The task at hand looks simple enough so I’ll do it and post here the outcome for your review.

Your comments are welcomed…


Attaching suggested improved CLinkColumn…

I’ve release this as an extension: http://www.yiiframework.com/extension/pclinkbutton/

Great job!

It may be an old topic but your extension saved me from some trouble.

Dynamic CLinkColumn image, dependent on the record’s data in a grid,

this should definitely be part of the core framework.

A must have.

Many thanks.

Thanks for the feedback!