Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

Dynamic alter colour cell with JavaScript

$
0
0

Hello Guys,

 

I'm facing the current problem:

 

I want change a colour cell depends on the value of the cell variable. I'm using the following JavaScript code on the initialize event of this cell

 

 

data.First.MainTable.Table1.Row1.Cell6::initialize - (JavaScript, client)

 

var numrows = xfa.resolveNodes("data.First.MainTable.Table1.Row1[*]").length;

 

 

for (var i = 0; i < numrows; i++)

{

    var LV_DATA = xfa.resolveNode("data.First.MainTable.Table1.Row1[" + i + "].Cell6");

  

    switch(LV_DATA){

 

       case LV_DATA <= "2":

            this.border.fill.color.value = "0, 153, 0";

            break;

       case LV_DATA >= "3" && LV_DATA <= "6":

            this.border.fill.color.value = "255, 255, 0";

            break;

       case LV_DATA> "6":

            this.border.fill.color.value = "255, 0, 0";

            break;

       default:

            this.border.fill.color.value = "255, 255, 255";

    }

}

 

Print1.PNG

My output values is:

 

Print2.PNG

With this output on column RISK Level I should get the first two cells red and the last one yellow.

 

Can you help me?


Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>