Description
The State
of a button determines whether a button is active (1
) or disabled (0
). A disabled button cannot be clicked and appears grayed out for the user. This function is useful for dynamically adjusting buttons based on specific conditions, such as project progress or the presence of required data.
The state of a button can be set by directly specifying 0
or 1
or dynamically controlled using an if
condition.
Usage
- State = 1: The button is active and can be clicked.
- State = 0: The button is disabled and cannot be clicked.
- Dynamic State: The state is controlled by an
if
condition based on project fields or other criteria.
Examples
Description | Formula |
---|---|
Button always active |
createButton( 1, "Active Button", "This button is active and can be clicked", "action()", "", "", "", "Description of the button", "", "envelope" ) |
Button always disabled |
createButton( 0, "Disabled Button", "This button is currently disabled", "action()", "", "", "", "Description of the button", "", "envelope" ) |
Button with if-condition |
createButton( if(projectFlavor("Status") == "Active", 1, 0), "Dynamic Button", "This button is activated when the project is active", "action()", "", "", "", "Description of the button", "", "envelope" ) |
Notes
- Use the
state
parameter to ensure that buttons are only active when all requirements are met. - Utilize
if
conditions to dynamically control the state based on project fields or other data. - Ensure that the conditions used are correctly defined to avoid unexpected behavior.
Comments
0 comments
Please sign in to leave a comment.