Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset on modal load #20

Open
mikebalder opened this issue Feb 26, 2014 · 4 comments
Open

reset on modal load #20

mikebalder opened this issue Feb 26, 2014 · 4 comments

Comments

@mikebalder
Copy link

thanks for the great code.

I am using it on a bootstrap 3 modal form. i want to reset the rating after the form is closed, so next time I load the form it is zero and not whatever the last rating was. struggling with how to do this. Any insight would be appreciated.

@bhoward00
Copy link

I think I'm looking to do something similar - I use PJAX (https://github.com/defunkt/jquery-pjax) to load new pages. When I have a bootstrap-rating-input on a page, and then I swap that page out, the same input on subsequent pages with different data are not caught by the bootstrap-rating-input code - they render as number-selecter inputs.

I've tried calling varieties of the last two lines of your code, to re-run rating() on newly added inputs in the DOM, but I'm struggling to figure out exactly how. It would be sweet if there were an easily callable way to have the BRI code re-run....

Or any insight on how to get BRI to re-run to detect new inputs added to the DOM after document.ready...

@vertein
Copy link

vertein commented Mar 6, 2014

I also had a similar problem at UW-Madison. We wanted to set a value and then have the stars redrawn to reflect that value. We use a modal and we don't set the stars (db hit) until the modal is shown. So we have to have it initially made, then the values set, then the stars drawn out to reflect this. My latest commit does that. Maybe you could use it to reset the value to zero on an event and then redraw the stars to zero? Take a look: https://github.com/vertein/bootstrap-rating-input. Let me know if you want to see my code in action.

@javiertoledo
Copy link
Owner

There is not a "clean" way to reset it yet, but I'd try to remove the stars from the DOM, add a new input and then call to $(your_new_input).rating().

@javiertoledo
Copy link
Owner

@vertein your code looks really good and implement some of the most requested features, I'd really appreciate if you want to send a pull request ;-)

@javiertoledo javiertoledo reopened this Aug 12, 2014
@javiertoledo javiertoledo self-assigned this May 25, 2015
@javiertoledo javiertoledo removed their assignment May 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants