Change value of another cell based on one cell input
Change value of another cell based on one cell input
aungkohein
Posts: 38Questions: 5Answers: 0
Hi!
Suppose I input a value in column 1, I want to auto change the value of another cell in column 2 (same row), what is the syntax I should use in "????" ?
table.abc.js:
$( editor.field( 'columnA' ).input() ).on( 'keyup', function (e, d) {
if ( ! d || ! d.editor ) {
if ( ???? ) {
editor.field( 'status' ).val( "Open");
}else {
editor.field( 'status' ).val( "Closed");
}
}
Please help!
This discussion has been closed.
Replies
Hi @aungkohein ,
You could use
dependent()
for that,Cheers,
Colin
Hi @colin!
Thank you for the help. I read the dependent() api but only managed to understand the show/hide on popup form. I hope there is more full examples with to it.
I chanced upon this which solved the issue: https://editor.datatables.net/reference/api/field().input()
cheers!
Hi @aungkohein ,
This here may help - it shows
dependent()
being used as I mentioned before. What you have though is good, so no point changing!Cheers,
Colin
Hi @colin,
Great example. Will implement it also in other parts. Thanks! =DD
Hi @colin,
I tested the earlier code. It only work if keyboard is used to select the dropdown value (autocomplete). If I use mouse to select the value from the autocomplete dropdown, the change event did not fire.
I tried all the $( editor.field( 'job' ).input() ).on( 'xxxx', ...), but does not work.
What syntax should I use?
I tried adding dependent() but there is no effect:
})
Dependent() does work because I'm using Inline Editor. How can I use dependent() and submit on keyup?
What auto complete library are you using? Can you give me a link to your page so I can take a look?
Allan