changing "enabled" value of a button during runtime in flex

Posted by ruchir patwa on Stack Overflow See other posts from Stack Overflow or by ruchir patwa
Published on 2010-06-15T12:21:16Z Indexed on 2010/06/15 12:32 UTC
Read the original article Hit count: 189

Filed under:
|
|
|

i want to make a button disabled if a datagrid is empty and it should be enabled when there is atleast 1 entry.the entries in the grid are made at runtime.I tried this this is the button:

<mx:Button id="update" label="Update Contact" enabled="{isButtonEnabled()}"/>

and the function is defined as where dg_contact is the datagrid:

public function isButtonEnabled():Boolean
{
     if(dg_contact.selectedIndex==-1)
    {
        return false;
    }
    else
    {
        return true;
    }
}

where am i going wrong?

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript