drgullin / icheck

Highly customizable checkboxes and radio buttons (jQuery & Zepto)
http://fronteed.com/iCheck
7.38k stars 1.62k forks source link

Refresh iCheckbox when users click Back in Browser #252

Closed davidt22 closed 8 years ago

davidt22 commented 9 years ago

Hi,

There are one issue when an user clicks on the "Back" button of the browser or using the right click button option and selects "Back".

The checked iCheckboxes are not updated and are marked instead of do a new read of the checked and not checked checxboxes .

There is any way to force the plugin to read the document and update the iCheckboxes when users clicks to go "Back" ?

Thanks

drgullin commented 9 years ago

Provide a test case please.

davidt22 commented 9 years ago

If you go to this URL (https://en.yeeply.com/developers/c:full+c:games+c:uxui) you will see three "CATEGORIES" selected. If you select another one category, the page will reload with a new content, ok? If you go "Back" using the button of the browser, the last category that you selected will not be selected, but your iCheckbox is showing selected.

davidt22 commented 9 years ago

Have you test it ? Have you found the error when user goes back ?

radum commented 9 years ago

@davidt22 but the input is checked. If you remove the overlaying icheck you will see that it is checked. So not sure what the problem is.

davidt22 commented 9 years ago

@radum this is the problem. The problem is that the checkbox is not checked but the overlaying icheck is showing checked but it is not true. If you search in the code when you goes back after filtering the results, you will see this. The steps are: 1-Go to https://en.yeeply.com/developers/ 2-Click on "Android" checkbox on left sidebar and wait until the result are filtered. 3- Click on the "back" button of your browser(you will see this iCheck checked) 4- Inspect the code and look for the real input checkbox. You will find this:

As you can see, after doing this steps, the real checkbox is not checked, but the iCheckbox plugin is showing checked.

I think is a problem refreshing the value of the iCheckbox after going back with the browser.

radum commented 9 years ago

capture

You are doing something wrong

davidt22 commented 9 years ago

This is the html of the hidden checkbox. As you can see the hidden checkbox has not the attribute checked="checked" but the iCheckbox is checked after going back with the browser. Please test it and you will see this as me. I´m not doing any rare things, only go Back with the browser.

captura de pantalla 2015-03-24 a las 17 55 40

radum commented 9 years ago

That property doesn't have to be there to be checked. Test it in your console $('input:eq(11)').prop('checked') and see that it is. Also remove all iCheck divs and show the native checkbox and you will see that is checked.

That checked property is used if you want a checkbox to checked on pageload by default. So it's fine, it is checked.

davidt22 commented 9 years ago

Ok, tomorrow I will record a video to show you better what is the error. Thanks

radum commented 9 years ago

@davidt22 This is what I'm saying David, you already told us what is the problem, that you can't see that checked property on the HTML node. But it doesn't have to be there for a checkbox to be checked.

davidt22 commented 9 years ago

I dont understand the last phrase of the last reply. Can you help me with this problem ? Or have I to search another solutions? Thanks ¡

radum commented 9 years ago

@davidt22 you don't have a problem. Everything works as expected. This is what I'm saying.