Page 1 of 1

Unable to enable/disable toggle

Posted: Tue Apr 15, 2014 9:08 pm
by Yan Yi

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?

Unable to enable/disable toggle

Posted: Wed Apr 16, 2014 7:01 am
by Kateryna Grynko

Hi Yan,

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


Unable to enable/disable toggle

Posted: Wed Apr 16, 2014 12:30 pm
by Yan Yi

works, thanks!


Unable to enable/disable toggle

Posted: Mon Jan 05, 2015 4:46 pm
by Istvan

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


Unable to enable/disable toggle

Posted: Mon Jan 05, 2015 11:54 pm
by Yurii Orishchuk

Hello,

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

Regards.


Unable to enable/disable toggle

Posted: Tue Jan 06, 2015 8:20 am
by Istvan

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


Unable to enable/disable toggle

Posted: Tue Jan 06, 2015 12:05 pm
by M&M

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


Unable to enable/disable toggle

Posted: Fri Jan 09, 2015 5:58 am
by Yurii Orishchuk

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.


Unable to enable/disable toggle

Posted: Fri Jan 09, 2015 9:40 am
by Istvan

Hi Yurii,

Thank You!

Working :-)