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

Adding Shared Code #302

Open
kobi2c opened this issue Dec 19, 2022 · 2 comments
Open

Adding Shared Code #302

kobi2c opened this issue Dec 19, 2022 · 2 comments

Comments

@kobi2c
Copy link

kobi2c commented Dec 19, 2022

Would it be possible to add "shared code" text field to computed fields UI?

Motive

The idea is "Shared code" will be prepended to each expression:

  • Formula
  • Cell computed CSS
  • Rows computed filter
  • Rows computed CSS

It will make it much easier to maintain the table since there will be one place to update the repeated code ( variables, columns titles, functions and so on).

Sample use case

Suppose we have the following expression in each computed field:

cssChange(s1) = if ( s1 >= 0 , "color: #480" , "color:#F00" ); cssChange(value)

If we want to update the colors, we need to update all the computed fields.
It is time consuming and error prone :(

However with the shared code feature, we can write in the shared code:

cssChange(s1) = if ( s1 >= 0 , "color: #480" , "color:#F00" );

And in each computed field:

cssChange(value)

Now it is much easier to change the colors as we need to update the code in one place :)

@fbaligand
Copy link
Owner

This could be an enhancement.
How would you see that feature?
A textarea named "Shared code"?

@kobi2c
Copy link
Author

kobi2c commented Dec 21, 2022

Yes, textarea named "Shared code" in "Enhanced Settings" section.

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

No branches or pull requests

2 participants