0

I am trying to validate null values in a column and i have to update another column based on this validation. My request is,

  1. Say i have Column 'Type' , if column 'Type' has some value in DB means i have to display tick mark in "Valid" column in CGridView. (Valid column is psuedo column)

  2. Column 'Type' has null values means i have to display untick mark in "valid" column.

Please provide any idea over this.

enter image description here

1
  • show your cgidview code. Commented Dec 26, 2013 at 6:38

1 Answer 1

1

Add New Column in Gridview with

array('name' => 'Status',
            'value' => '!empty($data->type) ? "<img />" : "<img tag/>"',
            'type' => 'raw'),

you can put your image tag with src in this.

Sign up to request clarification or add additional context in comments.

5 Comments

how to give image source path ? i pasted inside images folder
just like add <img src="YOUR IMAGE PATH" />
<img src="ccvv7/images/update.png" /> not working getting error in Grid Valid column
use like this 'value' => '!empty($data->type) ? "<img src=\"ccvv7/images/update.png\" />" : "<img src=\"ccvv7/images/update.png\" />"',
Its working, i used image like this 'value' => '!empty($data->type) ? CHtml::image(Yii::app()->request->baseUrl."/images/tick.jpg") : CHtml::image(Yii::app()->request->baseUrl."/images/untick.jpg")' ,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.