Skip to main content


Hi..

 

I'm wondering if there is a way to change background color of a cell in Table control in Smartform?

I know you can change the style and text format for the control (ex. Lable) that is inside the cell, but that's will not change the color of the whole cell.

 

Thanks in advance.

This is possible to do using the following CSS (it can be placed in the CSS file of the theme that you are using)


 


#db890559-87e0-5916-b58e-2509ba091bae 

background-color: #007F00; 


The ID you see above (db8905…) will differ on your environment, to get that value, you will need to inspect the HTML (right-click next to the label and select inspect element lChrome], or View Source SInternet Explorer]) 

The section will look something like: 
<tbody> 
<tr id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> 
<td id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" style="padding:2px;width:50%;" class="editor-cell droptarget">...</td> <- this will be the first cell in the table
</tr> 


 



Currently there's not a way to do this on the fly in the Designer or on the form. 

I hope this helps!


Hi Asalhani


 


Here is an external link which explains how this could be been in K2 smartforms: http://scn.sap.com/thread/1007404


http://community.k2.com/t5/K2-blackpearl/Smartforms-background-color/td-p/59579 and a post on the community but this covers smartforms backround. 


 


Hope this will help


 


Regards


Nelly


Hi


 


Client Question - change background color of a cell in Table control in Smartform?.


 


At the moment this cannot be done with without having to code it. The previously mentioned code could possibly work but Note that K2 does not support custom coding.


 


I would suggest that you log this as a feature request by logging a ticket for this issue in order for us to investigate the issue in depth and provide a solution if possible otherwise it would be logged as a feature request.


 


I tested this and my finding were:


List View - only the label color is changed not the entire cell


Editable List View - only the label color is changed not the entire cell


Item View - the entire textbox changes to the specified color but I am assuming that you want to be able to change the cell color on either a List View or Editable List View.


 


 


For Anyone interested in changing the background color of all VIEWS, which helps users find input fields, this is how I discovered it could be done:

 

1. Add a label called “hdn Javascript Change View Background Color” to the form

2. Set the text of the label to

<script type="text/javascript">$(document).ready(function() {$('.panel-body').css('background','#e5e5e5);})</script>

 

The label is invisible to the user.

 

12635i6BCA2BE2EB3FA9EC.jpg


I'd be wary of using the table's system generated id as you have no way of guaranteeing it remains consistent.

 

Similar to JoeWright (there's a single ' missing after the colour in the jQuery) and to specifically answer the question. Place a Data Label in the table cell and set it's name to TableCSS. Set the Expression of that data label to this, make sure Literal is checked.

 

<script type="text/javascript">$(document).ready(function() {$("spansname='TableCSS']").parent().css('background','#EBECE5');})</script>

 

To put a border around a layout table which is inside a cell in a view, you could do this. 

 

<script type="text/javascript">$(document).ready(function() {$("span name='TableCSS']").closest('table').css({'border':'gray 1px solid', 'background':'#EBECE5'});})</script>

 

 


Reply