Automatic change of one field after changing another
Automatic change of one field after changing another
keker
Posts: 14Questions: 4Answers: 1
Hello. Can I make it so that when the value in one of the cells changes, the function of updating the value in another cell automatically works? For example, there are fields "Number 1", "Number 2" and "Sum". After changing the fields "Digit 1" or "Digit 2" the function of the amount recalculation should work and further the received value should be updated in the "Amount" cell. All this should be preserved in the database, and then return the value to the cell.
This discussion has been closed.
Answers
Hi @keker ,
Take a look at this example - it's called dependent fields. You define them with
dependent()
.Cheers,
Colin
But how to apply dependent() under several fields at once?
If you look at the reference page in my second link above, it says that field "can also be given as an array of field names to allow the same callback options to be used for multiple fields.".
I did it. But the method dependent() is called on the entire line, even when the focus is on another cell not specified in the array of fields.
Hi,
You would need to use
dependent()
on the two fields together. For example you could do:Allan
And the last question. The docs says: "You can also modify the event listener using the event option of the third parameter". But in your example third example is "callback". How can I get the type of event?
Hi @keker,
That's the final example on that page for
dependent()
. That third option can be one of several things (event, data, preUpdate and postUpdate), they're described higher up on that page.Cheers,
Colin