cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to use getMatchValues, setMatchColors in iGrid

Former Member
0 Likes
525


Hi,

I am using MII 14.0 SP04.

I want to set the colors of a row based on a column value at run time for a iGrid.

Is it useful to use getMatchValues, setMatchColors in this context?

If any one know to use this or set the color of iGrid at run time based on Grid value, please explain how to use.

I try for setCellBackgroundColorAsString. After few minutes, the colors are disappeared.

Thanks,

Raman N

Accepted Solutions (0)

Answers (1)

Answers (1)

swaroop_anasane
Active Contributor
0 Likes

Hi Raman,

Match Values and Match colors can be defined in iGrid Template. Once you provide value ranges, it compares the values dynamically and assignes colors accordingly.

Not necessarily you should use this in code, the configuration from template itself should work.

Thanks and Regards,
Swaroop

Former Member
0 Likes

Swaroop,

Thanks for your answer.

In my case, I am making query of column names dynamically as user chosen. So I want to know how to use these two functions.

Thanks,

Raman N

swaroop_anasane
Active Contributor
0 Likes

HI Raman,

In that case, you can provide setMatchValues(comma separated string for list of values). Correspondingly, you can provide values in setMatchColors as well.

Hope this helps.

Regards,

Swaroop

Former Member
0 Likes

Swaroop,

Could you please provide sample code if you have?

Thanks,

Raman N

swaroop_anasane
Active Contributor
0 Likes

Hi Raman,

Please share your code, i would tweak it to make it work.

Check if you have used updateGrid(true) or not.

Otherwise, i would have to re-created whole scenario that may require some time.

Below link would further help you to play with these properties.

iGrid Reference

Thanks,

Swaroop

Former Member
0 Likes

Hello Raman,

I created a example and the details are below. Pl check if this is helpful.

I have following Grid with Tag data.

Now in my Java script code I mentioned all the required conditions as below.

1. Grid.getGridObject().setDynamicBackground(true);

2. Grid.getGridObject().setMatchColors("Green,Red");

3. Grid.getGridObject().setMatchColumns("Fan1");

4. Grid.getGridObject().setMatchValues("Integer:EXACT_MATCH:1,Integer:EXACT_MATCH:0");

5. Grid.update(true);

Statement 1     :  Setting DynamicBackground color checkbox to true.

Statement 2     :  Setting Match colors as Green and Red

Statement 3     :  Setting Condition for Column Fan1

Statement 4     :  This is the format we need to specify our condition. Integer is the type and if it is exactly Matches to 1 and 0. 1 indicates Green and 0 indicates red according to Statement 2.

Statement 5     :  Update Grid with latest changes

I enclosed all this code in a function which will be called on a button click. So once the button is clicked, above code gets executed and output will be like this.

Pls find the below screenshot of the complete code.

Thanks,

Sriram

Former Member
0 Likes

Sriram,

Thanks for your reply. Your code is working fine.

I have two column. One is Priority and another is Projection. If Priority is 1, I should make the row to red and Projection have any text then the row should be blue. If both priority is 1 and Projection has a text then color of the row can be red or blue.

Please advice how to do.

Thanks,

Raman N

Former Member
0 Likes

Hi Raman,

Enhance your Transaction/Query that it will give data as below.

Then you can use the above method and set the color context Run time like this.

Grid.getGridObject().setMatchColors("Red,"Blue");

Grid.getGridObject().setMatchColumns("Color");

Grid.getGridObject().setMatchValues("String:EXACT_MATCH:Red;String:ExactMatch:Blue");

It will result in your grid like this :

Regards,

Sriram

Ask a Question