Skip to Content
Technical Articles
Author's profile photo James Lim

SAC Analytics Designer – change color in the table dynamically for notifying which cell is editable

Recently one of my colleague asked to me how we can change “color fill for editable cells” to red for read mode and green for input mode?

 

so I made a quick prototype for doing it.

It can be done using custom CSS.  For detail, please read this blog

https://blogs.sap.com/2020/09/28/css-in-analytic-application-sac/

 

Here is my prototype.

There are two button for turning on and off.  Key Performance Indicators are locked so only Operating Income can be editable.

 

 

so I defined two custom CSS sets.  .Edit_On and .Edit_Off

.Edit_On .sap-custom-table-editable-cell{

background-color: green;

color:white

}

.Edit_Off .sap-custom-table-editable-cell{

background-color:orange

}

 

Then in the code of button, We can use below code.

 

// for button on

Table_1.setEnabled(true);

Table_1.setCssClass(“Edit_On”);

 

//for button off

Table_1.setEnabled(false);

Table_1.setCssClass(“Edit_Off”);

 

When you run the app, then click On button, then only editable cell will be changed the color as below and you can edit.

When you click off button, then it will change the color and you can’t edit it.

 

 

It is quite simple trick to do 🙂

Thanks!

 

 

Assigned tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Afshin Irani
      Afshin Irani

      Hi James,

      Thanks for this I was looking for an example and its a very clever way of doing this. Also I was looking for an example where  we can make a cell updatable based on the version i.e. cells are locked and unable to be edited if the version is Actual.

       

      Thanks

      Afshin