Show value in every CGridView’s row except first and last

It is quite easy for not showing something in the first row in CGridView. You need to use 'visible'=>'$row > 0' row expression. But, it becomes difficult, when we want to show something in every row except last one.

After some discussion on Yii forum we’ve figured out that using jQuery is the only way.

You have to give every element that you put to a row a special class (or, if you’re using buttons only in CGridView, then limit your selection to buttons), select all elements, that contains this particular class and use :last-child or first-child (for first row) selectors. Details in Yii forum,

Leave a Reply