How to display delete, edit icons?

What is the easiest way to display the delete (X) and edit (pencil) icons outside of the CGridView widget?

What do you mean by "outside"? And what would be the behavior of these icons? Just images? Or something would happen when clicking them?

How many rows are you displaying in the grid?

If it’s just 1 it would be relatively easy, otherwise you would need to create a usable interface that lines up the icons with each row, in which case they might as well be in the grid where they are.

Could you explain the use case?

They would be images that, when clicked, would pop up a Jquery dialog box.

I plan on putting these images in draggable list elements on the page. I want to be able to edit and delete the contents of the list elements.

Sorry, I’m still confused… would they interact with the grid rows at all or do you just want the images?

I just want the images. I’m not even using CGridView.

Ah, ok no worries :)

You’ll find them here:


So I guess I should just copy them to a public images folder and link to them. Is that the easiest way to display them?

Yes, that would be fine:

With images folder at root it would look something like below:

<a href="#your-action"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/delete.png" alt="Delete" /></a>

That works. Thanks for your help!