Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColorBackground by custom rule #218

Open
melquelima opened this issue Jan 10, 2025 · 0 comments
Open

ColorBackground by custom rule #218

melquelima opened this issue Jan 10, 2025 · 0 comments

Comments

@melquelima
Copy link

1 Colored Background Custom Value

im facing a few challenges on colorbackground based on rules like

Date colum-> color if date was expired
based into 2 columns valeus-> Col(A) == && Col(B) == "PENDING"

i was wondering if can be implemented a "Colored background-custom" Type format, that asks for a js function to return the desired color to color that cell, that function we can use payload (current row) to create the validations.

sample:

TypeFormat -> "Colored background-custom" -> shows up a js script window

sample 1

function condition(payload){
  if(payload.<my_field> > 1000){
      return "#ff0000" // red background
  }
  return null
}

sample 2

function condition(payload) {
    const today = new Date(); // Get the current date
    const inputDate = new Date(payload.colA); // Convert the string to a Date object

    // Check if the date has already expired and is PENDING
    if (inputDate < today && payload.colB == "PENDING") {
        return "#ff0000" // red background
    }
    return "#00ff00" // green background
}

2 Colored Background Hidden Field

i need to create a entire row background color based into a custom formula colum (i dont need to show), but when hidden the colored formula doesnt work, any chance to make it work even when field is hidden?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant