on ‎2015 Oct 15 8:42 AM
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
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Thanks,
Swaroop
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
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
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
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.