Using Rateit with twitter bootstrap popover

Jul 9, 2013 at 8:16 PM
I am trying to get rateit to work in a twitter bootstrap popover. I need to reinitiate it when the popover shows but I am not having any luck with it.

I created a fiddle: http://jsfiddle.net/mVSPR/4/

The fiddle just shows the range input slider though - not sure how to get it working there either.

Can anyone help me out?
Coordinator
Jul 10, 2013 at 6:30 AM
Hi,

You cannot link to the sources in codeplex. They do not return css and js. Download the sources, put them on some server, and then everything will work.
Jul 10, 2013 at 3:25 PM
Edited Jul 10, 2013 at 3:26 PM
Thanks gidon - first time using jsFiddle.

I updated the files so you can see exactly what I have now.

http://jsfiddle.net/mVSPR/5/

The rateit at the top is working fine, but once you click the button and get the popover, the rateit in the popover is not working. Any help would be appreciated.
Coordinator
Jul 10, 2013 at 5:44 PM
Fixed it: http://jsfiddle.net/mVSPR/6/

The thing is that when the popover is initialized, it clones the source element (the add-review-form) and puts it into the popover markup.
At this moment you have actually two 'add-review-forms' on your page.

The rateit bindings however are not cloned, so you end up with a half working rateit plugin.

The trick is , not to have rateit auto init the itself (I changed the div's class to rateit-popover), and then when the review button is clicked, and the popover is shown, only then we initialize it. Next time when the review button is clicked, it will happen again, but rateit is smart enough not to reinit itself once it is initialized.

Gidon
Jul 10, 2013 at 6:23 PM
Awesome - I figured it was something simple but just couldn't figure it out. I appreciate your help. Thanks!