EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: MFS on December 30, 2015, 12:31:00 AM



Title: [SOLVED] Enabe or disable button in tollbar???
Post by: MFS on December 30, 2015, 12:31:00 AM
Hello again.
(http://s18.postimg.org/4lpj8uoop/image.png)

I want to disable button when is Status in some state for example in my case "arhiviran".
If I click on row that have this value I want to disable EDIT ( Izmjeni ) and DELETE ( ObriĊĦi ).

How to make that?
Thanks.


Title: Re: Enabe or disable button in tollbar???
Post by: stworthy on December 30, 2015, 08:45:38 AM
Set the 'id' property for the linkbutton, you will be able to select it and then enable or disable it.
Code:
$('#btn-edit').linkbutton('disable');


Title: Re: Enabe or disable button in tollbar???
Post by: MFS on December 30, 2015, 11:54:15 PM
This is my code:

Code:
<script type="text/javascript">
$(function()
{
$('#ZZOGrid').datagrid
(
{
rowStyler:function(index,row)
{
if (row.STATUS=='arhiviran')
{return 'background-color:Aquamarine ;font-weight:bold;';};
}
}
);
});
</script>


Make your suggestions where and how to put code for disable btnBrisanje ( Delete button ) when row.STATUS=='arhiviran' ??


Title: Re: Enabe or disable button in tollbar???
Post by: stworthy on December 31, 2015, 01:01:02 AM
You must detect what row is selected and then decide if to enable or disable the button.
Code:
$('#ZZOGrid').datagrid({
    rowStyler: function(){...},
    onSelect: function(index,row){
        if (row.STATUS == 'arhiviran'){
            $('#btnBrisanje').linkbutton('disable');
        } else {
            $('#btnBrisanje').linkbutton('enable');
        }
    }
})


Title: Re: Enabe or disable button in tollbar???
Post by: MFS on December 31, 2015, 01:06:31 AM
This code work.
Thanks.