Perhaps this has been asked before but i couldnt find a post that represents my situation.
The thing is that i have a tableview and i must change the color (background color) of some fields (not the entire row) on the records, acording to a related field.
I tryied doing it on a rowBGcolorCalc without returning any color but setting the color of the fields there like
This works initially, i mean when i open the form i see the correct fields painted, but when i select a record, all columns paint or unpaint the field acording to the selected one, well not even like that, id say it has some strange behaviour and columns are painted and unpainted.
i thought of making a calc that returned some HTML code with the color and the field value, but my problem is that the user must be able to input some data on those fields, so just showing the calc there wouldt help me.
Any idea of how can i do this??
im using servoy 5.2.2
thanks in advance
Well i upgraded to servoy 6 and im having some problems, first of all now i have like 1600+ warnings that werent there and im getting exceptions in almost every thing i do, most of the things that were functioning right in servoy 5.2.2 now just break down.
And the onRender isnt doing what i need, its still working like the bgcolorcalc used to do, when i stand on a record it just paints the whole colums, heres what i do on the onRender event of one of the cells i want to paint dinamically
thanks a lot, the onRender works perfectly now and im working on solving the problems
My main problem was that the dbi files had errors, they lost reference to all servoy seq and most of my relationships gave errors, thanks for the link it’ll be very usefull
im with a similar problem, now i have to dinamically set the format of some fields, so i thought of using the on render and the putClientProperty
something like this
function onRender(event) {
var _record = event.getRecord();
if (_record && _record.resultados_to_varsexam.ingnum_vex) {
event.getRenderable().bgcolor = '#7cbae7'
event.getRenderable().enabled = true
event.getRenderable().putClientProperty("format","0.00")
}
is this possible? cause its not working, im probably doing something wrong or perhaps is not even possible
thanks
i don’t think we have support for setting the format through a client property.
That is on normal components just a property like: field.format = xxx
so doing that through a putClientProperty will not work
And we don’t seem to have support for setting the format property in the onRender event.
Please make a case for this, so that we can look to add that one also.
Also what you do there is especially for 6 (we improve it for 6.1) not quite correct.
If you set some property in the onrender, you really always have to set or reset it.
So if you do this:
if (condition)
{
renderable.bgcolor = red;
}
then you have to also do an else:
else {
renderable.bgcolor = “some default”
}
else for cells that don’t meet that condition it will be the bgcolor of the previous one (so red)
mmm do i have any other way to do it?
let me explain my situation, i have a foundset where the user inputs some data on table view, and on a field on a related table i have the number of decimals that input should have. Its not “dinamic” because that wont change during the input process, but i need to set the format for each of the fields on the table view.
for example, considering record A, my related table sais that it should have 2 decimals
for record B it says 3 decimals, so on the tableView i should have
A | 0.00
B | 0.000