EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: hunsin360 on July 15, 2015, 03:17:26 PM



Title: Disable Dialog buttons
Post by: hunsin360 on July 15, 2015, 03:17:26 PM
I just tried out version 1.42 and something big changed with dialog toolbars and buttons.  For example, I used to be able to define a dialog button and give it an id:

...
buttons: [{
   text: 'My Button',
   id: 'mybutton'
}]

And then disable or enable it programmatically:

$('#mybutton').linkbutton('disable');

This no longer works.  Is there another way or is this no longer possible?


Title: Re: Disable Dialog buttons
Post by: jarry on July 16, 2015, 01:20:16 AM
To disable a linkbutton, you can call 'disable' method or set the 'disabled' to true.
Code:
<script type="text/javascript">
  $(function(){
    $('#dlg').dialog({
      buttons: [{
        id:'mybutton',
        text:'Ok',
        iconCls:'icon-ok',
        handler:function(){
          alert('ok');
        }
      },{
        text:'Cancel',
        disabled:true,
        handler:function(){
          alert('cancel');;
        }
      }]
    });
    $('#mybutton').linkbutton('disable');
  })
</script>


Title: Re: Disable Dialog buttons
Post by: hunsin360 on July 16, 2015, 08:15:04 AM
From my code snippet you could see that I am calling the 'disable' method.

I have other link buttons that I can enable\disable with no problems.  The problem appears to only occur if I try to access either a dialog toolbar or regular button.