Change color of label in each repeatbox row

116 Views Asked by At

How can i change the color of a label object (in a repeatbox row)? I would like to change the object's value if it is less than zero. Smartface should offer us some ease to do.

I draged and droped all page's objects and used webclient wizard. I tried to do something in onRowRender event but i could not get label value for each row. How can we access row objects programmatically in smartface app studio?

1

There are 1 best solutions below

0
On BEST ANSWER

You can change the color of the Label object in repeatbox onRowRender function.

onRowRender first write this code to catch the index of your Dataset:

Data.DS_MyDset.seek(e.rowIndex);

Now by seeking e.rowIndex, you get the same index from your Dataset. After that you can write an if block to check if Label's value less than 0 for every row.

Your rowRender function will be like this:

function Page1RepeatBox1OnRowRender(e){
Data.DSMyDset.seek(e.rowIndex);
if(Data.DSMyDset.labelValue < 0){
Pages.Page1.RepeatBox1.Label1.fontColor = '#00FF00';
}else{
Pages.Page1.RepeatBox1.Label1.fontColor = '#FF0000';
}
}

Smartface.io Team