Yan Yi
Posts: 0
Joined: Sat Jan 25, 2014 7:38 pm

Unable to enable/disable toggle

Hi, this question is regarding disabling and enabling toggle.

I am able to enable/disable slider widget using the below code, but not toggle. According to JQM website they have the same methods.

Works (slider):

codeAppery('temp_slider').slider('disable');
Appery('temp_slider').slider('refresh');
/code

Does not work (toggle):
code
Appery("temp_toggle").slider('disable');
Appery("temp_toggle").slider('refresh');
Uncaught Error: cannot call methods on slider prior to initialization; attempted to call method 'disable'
/code

Does not work (toggle):
codeAppery("temp_toggle").toggle('disable');
Appery("temp_toggle").toggle('refresh');/code

Does not work (toggle):
codeAppery("temp_toggle").attr('disabled', true);/code

Does not work (toggle):
codeAppery("temp_toggle").val('off');/code

two questions:

  1. how to enable/disable toggle
  2. how to turn toggle on/off using javascript?
Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Unable to enable/disable toggle

Hi Yan,

Use the following code:preAppery("temp_toggle").flipswitch( "disable" );/pre

Yan Yi
Posts: 0
Joined: Sat Jan 25, 2014 7:38 pm

Unable to enable/disable toggle

works, thanks!

Istvan
Posts: 0
Joined: Mon Oct 13, 2014 1:48 pm

Unable to enable/disable toggle

Hi.

The slider example it is usefull to me, but how can i change the disable - color (grey)? I would like use slider only to show value and if disable the became to grey.

I saw in the css but didnt find where :-(

Thanks

István

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Unable to enable/disable toggle

Hello,

Currently it's not clear what you want to do.. Please give us more details about it. Screen shots are welcome.

Regards.

Istvan
Posts: 0
Joined: Mon Oct 13, 2014 1:48 pm

Unable to enable/disable toggle

Thanks Yurii

Sorry for my weak english...

Image

This is after disable, but i would like to keep the original colors or more visibile ...

Image

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

Unable to enable/disable toggle

hi,

Actually any object when you disable it, it will be greyed out. That is a standard behaviour. This is to indicate to the user that you cannot change it's value.

If you really wish it to remain colourful but yet not respond to user input, I guess you will have to "*lock" it in some way instead of disabling it. I am not very sure but there is a possibility of placing that component inside another component, and disable the parent component. I am not really sure whether it will work exactly the way you want.

*P.N: It may confuse the user cos he has no idea why the control does not respond to his input.

Cheers,
M&M

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Unable to enable/disable toggle

Hi Lstvan,

To get undisabled view in disabled state for slider component - please use following JS code:

pre

//Note: you should replace "mobileslider_75" with your slider component name.
var slider = Appery("mobileslider_75");
slider.slider( "disable" );

var container = slider.closest('[data-role="fieldcontain"]');
container.find(".ui-state-disabled").removeClass("ui-state-disabled");

/pre

Regards.

Istvan
Posts: 0
Joined: Mon Oct 13, 2014 1:48 pm

Unable to enable/disable toggle

Hi Yurii,

Thank You!

Working :-)

Return to “Issues”