Capture double click on Yii’s CGridView row

I was using a simple Javascript code (attached to CGridView.selectionChanged property) to capture click on any grid view’s row and redirect user to row-specific URL. I wanted to change it to double click only.

CGridView exposes selectionChanged even only, no click or dblclick, so that was a quite nice challenge. It seems that the only way is to capture this event yourself.

Read More “Capture double click on Yii’s CGridView row”

Delete model with relations

To delete in Yii a model with some relations we usually have at least three options.

Depending on many factors (RDBMS type, table type, situation, context etc.) most of them have advantages and disadvantages. Good developer already knows these options, so intention of this post is not to discuss them, but to show you an interesting, new (at least for me) fourth approach to solve this problem, that I found recently.

Read More “Delete model with relations”