why do we "Yii::app()->clientScript->registerScript" in the view when we can just
<?php $this->widget('zii.widgets.grid.CGridView', array(
In my opinion, Yii::app()->clientScript->registerScript has two major shortcomings:
A) Maintenence, since front-end and back-end code is mixed up, it becomes even worse when CSS is involved.
Time pause due to cloning large JS libraries like CKEditor, ExtJS … You can feel the back-end operation.
Personally, I prefer the traditionally simple way.
The assets dir should only have to copy the js 1 time though after that it’s fast… but other problem is…
And then I just register the url
It might be slower but I’m willing to sacrifice that and file caching should cure most of that
And when using3rd party script maybe some component has and old version of the script or one includes a minified and one includes a normal version of the script and you get a double script included… but I guess we should always take care of that by allowing to override some public var script => false