eddysilvamendes / jquery-star-rating-plugin

Automatically exported from code.google.com/p/jquery-star-rating-plugin
0 stars 0 forks source link

New defaults in jquery ready #20

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create form with stars
2. Add new defaults definition into jquery ready function like this
 $(function() { 
   $.extend($.fn.rating, { options: { required: true } });
}
3. It doesn't work, new defaults isn't applied

What is the expected output? What do you see instead?
I find way how to set plugin's readonly settings based on form's class
(which is generated on server). When I add new settings outside of jquery
ready function new settings is applied, but I should determine form's class
inside jquery ready function and it doesn't work. Maybe it's my fault and I
don't know some principle of jquery plugins

Thanks

What version of the plugin/jQuery are you using?
PLUGIN VERSION:3.10
JQUERY VERSION:1.3.2

On what browser(s) or operating system?
BROWSER(S): IE, FF

Please provide a link to where the problem can be observed:
URL:

Feel free to provide any additional information below.

Original issue reported on code.google.com by petr.sno...@gmail.com on 26 Mar 2009 at 7:20

GoogleCodeExporter commented 8 years ago
Sounds like the plugin is being loaded before you've changed the configuration.
Check the order in which your script is being executed.

OR, you can also use the "disabled" attribute as the examples demonstrate on 
the 
plugin website:
http://www.fyneworks.com/jquery/star-rating/

Original comment by diego.a...@gmail.com on 26 Mar 2009 at 12:40

GoogleCodeExporter commented 8 years ago
Yes, I want change my script order, but I don't know how.
When I add new defaults into jquery ready function it doesn't work. And If I id
outside ready function form may not be ready for reading. I'm interested on how 
to
put my script before stars script initialize itself.

Setting disabled helps, and I don't want waste your time. If you know what I 
mean I'm
interested in solution, if not never mind. Thank for help

Petr

Original comment by petr.sno...@gmail.com on 26 Mar 2009 at 1:08

GoogleCodeExporter commented 8 years ago
You should do it in this order:
1. include jquery
2. include plugin
3. $.extend($.fn.rating, { options: { required: true } });
4. Add star class to input element
5. jQuery will automatically initialize plugin here

Original comment by diego.a...@gmail.com on 1 Apr 2009 at 11:22

GoogleCodeExporter commented 8 years ago
And what if I need call $.extend based on another element? I should check 
element
value in $(function(). and it looks like step 5 is passed.

something like this dosn't work
$(function() {
if ($('#rating_form').hasClass('readonly')) {
    $.extend($.fn.rating, { options: { readOnly: true } });
}
});

Original comment by petr.sno...@gmail.com on 1 Apr 2009 at 12:20

GoogleCodeExporter commented 8 years ago
No.

Just use another class and initialize the plugin yourself with your own 
options, like 
this:

$('.readonly-stars').rating({
 readOnly: true
});

Original comment by diego.a...@gmail.com on 1 Apr 2009 at 1:26

GoogleCodeExporter commented 8 years ago
Thank you for your time, disabled attribute works perfect in my scenario. I 
only want
know if I'm not doing something wrong.

Thank you again
Petr

Original comment by petr.sno...@gmail.com on 1 Apr 2009 at 5:24