Button selection color

Clinkscake
New Contributor III

Currently, there is an option to change the "hover color" on button components. Is there an option to change the color once the button is selected? In my current dashboard, we have multiple buttons and it would be nice if the button a user selects would change colors, then it is apparent they are on that button.

1 ACCEPTED SOLUTION

EricOsmanski
Valued Contributor

This would be a good enhancement for IdeaStream. Currently, I have only seen it done by writing a XFBR String BR to change the image. The XFBR String would go in the "Image URL Or Full File Name" on the button.

View solution in original post

4 REPLIES 4

EricOsmanski
Valued Contributor

This would be a good enhancement for IdeaStream. Currently, I have only seen it done by writing a XFBR String BR to change the image. The XFBR String would go in the "Image URL Or Full File Name" on the button.

Do you happen to have anything you can share to change the image or example business rule? When we try to create a business rule using literal parameters, it doesn't work. 

Hello,

First, define the backgroundcolor of your button with something like this : "... BackgroundColor = XFBR(YourBusinessRuleName, YourFunctionName, variable1 = YourVariable) ..."

YourVariable, most likely, could be a parameter that will be set to "true" when you click on your button.

Then, play around with this code in YourBusinessRuleName XFBR below. It will have darkblue color if true, black if false.

 

If (args.FunctionName.XFEqualsIgnoreCase("YourFunctionName")) Then

' Get the variable :
Dim str_variable1 As String = args.NameValuePairs("Variable1")

' Initiate the output : 
Dim buttonColor as string = Nothing

  If str_Variable1 = "True"   Then
buttonColor = "XFDarkBlueBorder"
Else
buttoncolor = "XFBlack"
End If

Return buttonColor 

End If

Regards,

fc
New Contributor III

Hi,

I was looking into this post because I'm working on a dashboard and I'm trying to create a functionality that changes the background of a button when it's clicked.

I followed what was suggested here, but there is something that's not clear to me. 

 

As you suggested, in the formatting section of the button I added the XFBR line 

BackgroundColor = XFBR(BusinessRuleName, Function2, variable1 = YourVariable)

When the button is clicked by the user, a Function (let's call it Function1) in the BR BusinessRuleName is triggered and it performs a specific task, while at the same time it updates the parameter value to True (in you example the parameter was YourVariable). 

fc_0-1687422405633.png

 

Then I created another Function (Function2, the one that I placed within the formatting section of the button), which picks up the value of the parameter YourVariable and it returns a different background color based on whether the parameter value is set to True or False.

Summing up, within the BR I have 2 functions:

Function 1 performs a task when the button is clicked, and it updates the value of the parameter YourVariable.

Function2 retrieves the value of YourVariable and returns a background color. 

The problem is, Function2 never gets triggered, when the user clicks on the button only function 1 gets triggered. Am I doing something wrong, or is there something that I am missing?

 

Thanks in advance for any help!