If I attempt to register the jquery.min.js script on a controller/view generated by using yii’s shell crud command, I get the error :
jQuery("#yw0").yiiListView is not a function
Here is how I am registering it.
$cs->registerCssFile(‘http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel=“stylesheet” type="text/css’);
Any help would be appre
Thanks for your reply. I implemented scriptMap, removed the hard-coded reference to the asset folder, and put the css include in a link tag.
None of these actions fixed the js error.
I believe you are right in that I have somehow disabled the publishing/registration of the js necessary for CListView.
Here is what I currently have for registering the jquery necessary to implement an accordion left nav.
Any other idea?
Check out, which js files get loaded in your browser (e.g. using firebug’s network tab). It requires the file jquery.yiigridview.js. If it’s missing, try to disalbe scriptMap completely. If it’s still missing you must be doing something strange in your code. Maybe comment out all methods that use clientScript or assetManager to track it down.
I got the same error "jQuery("#yw0").yiiListView", visible on a page with a CListView object. I did not register any extra scripts, but noticed the error appeared after creating my own theme. When I looked at the source code, I saw the listview js was called before the jquery js file which was already in the template.
The line "<?php echo CHtml::encode($this->pageTitle); ?>" also outputs the registered scripts. When you already included jquery yourself, it will not include it again (*edit: it is still included but no JQuery object is created or something, anyways: ). Make sure to put the echo line as the last element in <head> to avoid errors like this.