Page 1 of 1

cannot call methods on checkboxradio prior to initialization; attempted to call method 'refresh'

Posted: Thu Jan 12, 2017 12:42 pm
by halilu

Good day

Title is the error I get when trying to update checkboxes on the success event of a service. The service is called on the load event

I would think the checkbox has been initialized at this point.

Code is

var setChannelsFromResponse = function (response) {
var channs = response.channels;

Code: Select all

 for (i = 0; i < channs.length; i++) { 

         Apperyio("mcb" + channs[i].toString()).attr("checked", true).checkboxradio("refresh"); 

 } 

}

I've tried various things including

using timeouts
using the init event.

No luck

I also see this has popped up before, but was unsolved

https://getsatisfaction.com/apperyio/...

Any ideas please? I feel like I'm clearly missing something here.

Thanks


cannot call methods on checkboxradio prior to initialization; attempted to call method 'refresh'

Posted: Thu Jan 12, 2017 1:04 pm
by Bruce Stuart

And, you don't put it in the page show method because ?


cannot call methods on checkboxradio prior to initialization; attempted to call method 'refresh'

Posted: Thu Jan 12, 2017 5:26 pm
by halilu

I had tried that, thanks. Same problem

But why should I be using the page show for this? I need it to load just the once. I would assume the checbox state would saved once it's been updated, no?

Page show would be needlessly more expensive. As it would have to call the service each time the page is shown, and not just on page load (which is less frequent).


cannot call methods on checkboxradio prior to initialization; attempted to call method 'refresh'

Posted: Thu Jan 12, 2017 8:32 pm
by Serhii Kulibaba

Hello,

Please use a JS below for that:
pre$("[name=myCheckbox] input")&#46;attr("checked", true)&#46;checkboxradio("refresh");/pre
here myCheckbox - name of the checkbox


cannot call methods on checkboxradio prior to initialization; attempted to call method 'refresh'

Posted: Thu Jan 12, 2017 10:13 pm
by halilu

Thanks man!

Guess I need work on my jquery-fu....

And learn when to use selectors (and how to use them properly) as opposed to using apperyio....