EasyUI Forum
September 14, 2025, 02:08:16 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [RESOLVED] switchbutton readonly change style  (Read 7373 times)
Kot_dnz
Newbie
*
Posts: 3


View Profile Email
« on: March 05, 2018, 03:26:12 PM »

Could you please help me and describe how can I able to change the style of switchbutton in readonly mode.

Switchbutton declared as:

<input class="easyui-switchbutton" value="1" name="hours_7" id="hours_7"
            data-options="onText:'Да',offText:'Нет'">

<style>
    .switchbutton-readonly {
        opacity: 0.5;
        filter: alpha(opacity=50);
    }
</style>

not working Sad
« Last Edit: March 07, 2018, 05:33:31 AM by Kot_dnz » Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: March 05, 2018, 08:06:35 PM »

A readonly switchbutton should have the 'readonly' property set to true.
Code:
<input class="easyui-switchbutton" value="1" name="hours_7" id="hours_7" 
            data-options="onText:'Да',offText:'Нет',readonly:true">

<style>
    .switchbutton-readonly {
        opacity: 0.5;
        filter: alpha(opacity=50);
    }
</style>
Logged
Kot_dnz
Newbie
*
Posts: 3


View Profile Email
« Reply #2 on: March 06, 2018, 07:07:19 AM »

Thank you.
But this is working only with predefined swbutton.

What about dynamically changing?
Mb require to redrawing the form?

Example:
Code:
<body>

<input class="easyui-switchbutton" value="1" name="sb" id="sb">

<div style="margin:20px 0;">
    <a href="#" class="easyui-linkbutton" onclick="$('#sb').switchbutton('options').readonly=true">On RO</a>
    <a href="#" class="easyui-linkbutton" onclick="$('#sb').switchbutton('options').readonly=false">OFF RO</a>
</div>

<style>
    .switchbutton-readonly {
        opacity: 0.5;
        filter: alpha(opacity=50);
    }
</style>
</body>

And nothing.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #3 on: March 06, 2018, 11:47:07 PM »

Call 'readonly' method to set its readonly state.
Code:
$('#sb').switchbutton('readonly');
$('#sb').switchbutton('readonly', false);
Logged
Kot_dnz
Newbie
*
Posts: 3


View Profile Email
« Reply #4 on: March 07, 2018, 05:33:11 AM »

Thank you!
Now all is working properly!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!