Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Change background color of a cell of a grid dynamically depending upon value of a persistent variabl
swapnilpingale
<div>Hi Guys,</div>
<div>Can anyone please help me in following scenario?</div>
<div><strong>Scenario</strong>:- Dynamically changing the background color of a cell of a grid depending upon a global variable value.</div>
<div>Actually am aware of changing the background color of a cell, but the problem is how to set and get the persistent variable in grid script and on which method i shall do this?</div>
<div>I have used persistent variable in case of chart where in i created the same in onfetch method of dataset and later used in another script like beforeGeneration() etc.</div>
<div>Can anyone let me know how to access the reportContext object and then set the persistent variable in case of grid please.</div>
Find more posts tagged with
Comments
Matthew L.
<p>Typically I use the following to SET and GET values globally:</p>
<pre class="_prettyXprint _lang-css">
reportContext.setPersistentGlobalVariable("MyVariableName", value.toString() ); //SET Global Variable Called 'MyVariableName'
var myValue = reportContext.getPersistentGlobalVariable("MyVariableName"); //GET Global Variable Called 'MyVariableName'
</pre>
<p>The following code gets the grid handle for a grid object called "MyGrid" and changes the background color of the upper left cell:</p>
<pre class="_prettyXprint _lang-js">
var GridHandle = reportContext.getDesignHandle().findElement("MyGrid"); //Get grid element handle
GridHandle.getCell(1, 1).setProperty("backgroundColor","#00FF00"); //Set background color of the upper left cell
</pre>
<p>As for the method's to use depends on when the dynamic data is available to adjust the cell.</p>
<p>I would say that its usually best to use the earliest method possible for when the dynamic data is available.</p>
<p> </p>
<p>Do you have an example you can post that would give me a better idea as to what you are wanting to accomplish?</p>
swapnilpingale
<p>Thanks <strong><span style="color:rgb(0,0,0);"><span style="font-family:arial, sans-serif;"><span style="font-size:10pt;">Matthew L.</span></span></span></strong></p>