I want change a specific property of specific field in a row of table, but I have some records in this table and when I change a property for a specific field this property change the value in every fields in that column.
I think servoy give a ID unique for every fields but I don’t know how obtain that ID.
If you want to change a property only for certain rows, you can use the onRender event, for example to set the background color of orders depending on the is_paid field:
function onRender(event) {
/** @type {JSRecord<db:/example_data/orders>} */
var _orderRec = event.getRecord();
var _element = event.getRenderable();
if (_orderRec && _orderRec.is_paid) {
_element.bgcolor = "#00ff00";
} else {
_element.bgcolor = "#ff0000";
}
}
If you want to change a property only for certain rows, you can use the onRender event, for example to set the background color of orders depending on the is_paid field:
function onRender(event) {
/** @type {JSRecorddb:/example_data/orders} */
var _orderRec = event.getRecord();
var _element = event.getRenderable();
As far as I can tell there’s no way you can individually change properties of elements (of different rows) in a table view. But the onRender method could actually give you a hand. You could try to change the property you need based on some value you can read from the record you retrieve from the JSRender event.
davide.bovio:
As far as I can tell there’s no way you can individually change properties of elements (of different rows) in a table view. But the onRender method could actually give you a hand. You could try to change the property you need based on some value you can read from the record you retrieve from the JSRender event.
What you could do is save the pk of the record in a form variable when you click the button. Then let the onRender color the element on the record with that pk.
What you could do is save the pk of the record in a form variable when you click the button. Then let the onRender color the element on the record with that pk.
Use the pk and the event onRender I have resolv my issue. I want to change the caption/text of button but I’m not able.
Thanks for help, someone else has other ideas?
Joas:
Do I understand correctly that you CAN change the bgcolor of the button for one row, but NOT the text? It should work the same for all properties.
What does your onRender method look like?
When I click on the button i can change the bgcolor of the button and the frcolor of button but not the text.
Probably I’m wrong, but now I’ve modify my solution and this problem is disappeared.