huyhk
(Huyhk)
September 7, 2010, 2:50am
1
Hello all,
I am new to YII, And I got a problem with CStarRating
Here is my code to create rating
<?php $this->widget('CStarRating',array('model' => $model, 'attribute'=>'rating',
'ratingStepSize'=>2,
'maxRating'=>10,
'minRating'=>1,
'name'=>'Topic[rating]',
'allowEmpty' =>false));?>
But it did not show the images, only the options. I inspected the output HTML and found an javascript error message:
Uncaught TypeError: Object #<an Object> has no method 'rating'
I also found that the js file (jquery.rating.js) already registered at /assets/87870dfa/jquery.rating.js and it has $.fn.rating method.
I downloaded a copy of this js file, placed it in my custom js folder and manually registered it, the stars appeared.
How do I solve this problem without manually register js file?
Thanks
DarkNSF
September 8, 2010, 12:11am
2
Hello all,
I am new to YII, And I got a problem with CStarRating
Here is my code to create rating
<?php $this->widget('CStarRating',array('model' => $model, 'attribute'=>'rating',
'ratingStepSize'=>2,
'maxRating'=>10,
'minRating'=>1,
'name'=>'Topic[rating]',
'allowEmpty' =>false));?>
But it did not show the images, only the options. I inspected the output HTML and found an javascript error message:
Uncaught TypeError: Object #<an Object> has no method 'rating'
I also found that the js file (jquery.rating.js) already registered at /assets/87870dfa/jquery.rating.js and it has $.fn.rating method.
I downloaded a copy of this js file, placed it in my custom js folder and manually registered it, the stars appeared.
How do I solve this problem without manually register js file?
Thanks
instead of setting name, set model and attribute
model=$topicModel
attribute=‘rating’
huyhk
(Huyhk)
September 9, 2010, 9:27am
3
Thanks for your reply.
But the problem is not widget.
My problem is: "jquery.rating.js" already registered but javascript error occur at "rating" method not found
tonnisw
(Tonnisw)
September 9, 2010, 7:59pm
4
First I would make sure you don’t have some kind of cached javascript problem (i.e. it is actually working, just not for you). Also, does your star rating control appear in a dialog that is populated via an AJAX request? A while ago I had some similar problems with the JavaScript of the star rating control in a dialog being loaded too many times (or something that I never had time to fully figure out) and I resorted to rendering the dialog contents in a hidden div when the page was first rendered instead of dynamically when the button was clicked. There is definitely a problem with the control when there is more dynamic rendering going on besides just the conversion of the radio buttons to stars. Like I said, I didn’t have time to figure it all out.
My 2 cents.
Zahra
(Momtazian)
June 20, 2012, 6:14pm
5
I have same problem. How I register it manually?!
storemalt
(Storemalt)
October 24, 2012, 8:42am
6
http://jquery-star-rating-plugin.googlecode.com/svn-history/r38/trunk/jquery.rating.js
download the jquery rating file here, then place it somewhere in your folders, then use the
$clientScript = Yii::app()->getClientScript();
$clientScript->registerScriptFile(‘path to your rating.js file’);
storemalt
(Storemalt)
November 12, 2012, 3:21am
7
is there a way to hide or remove the cstar rating, cancel rating button?