Yii Framework Forum: Have imageUrlExpression in CLinkColumn - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Have imageUrlExpression in CLinkColumn introduce dynamic evaluation of imageUrl Rate Topic: -----

#1 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 360
  • Joined: 23-January 11

Posted 29 May 2012 - 06:10 AM

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...
Boaz.
Therapeutic PHP sessions My LinkedIn Profile
0

#2 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 360
  • Joined: 23-January 11

Posted 29 May 2012 - 06:22 AM

Attaching suggested improved CLinkColumn...

Attached File(s)


Therapeutic PHP sessions My LinkedIn Profile
0

#3 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 360
  • Joined: 23-January 11

Posted 03 June 2012 - 05:51 AM

I've release this as an extension: http://www.yiiframew...n/pclinkbutton/
Therapeutic PHP sessions My LinkedIn Profile
0

#4 User is offline   MobiDev Corporation 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 10-June 12

Posted 28 July 2012 - 06:45 AM

Great job!
0

#5 User is offline   DavidD 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 26-August 09

Posted 13 May 2013 - 07:18 AM

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.
0

#6 User is offline   Boaz 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 360
  • Joined: 23-January 11

Posted 13 May 2013 - 07:21 AM

View PostDavidD, on 13 May 2013 - 07:18 AM, said:

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! Posted Image
Therapeutic PHP sessions My LinkedIn Profile
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users