precisions about dependent() 2 questions.
precisions about dependent() 2 questions.
Hello everybody.
First:
Anybody could explain me the difference betwwen
1) editor.dependent('individual.id', console.log('tata'), {event: 'change'});
and
2) editor.dependent('individual.id', function(val, data, callback) {console.log('toto');}, {event: 'change'});
In my console 1) make one 'tata' 2) make two 'toto'. Why ?
Second. When i open the editor, an event 'change' is detecting why ? (so i have 'tata' and 'totox2 in my console. I would like detect changes in certain fields but not when the editor is open. Is it possible?
Thanks a lot.
Lionel
Answers
This executes the
console.log()
when thateditor.dependent...
line of code is executed. The result fromconsole.log()
(which is undefined) is then passed as the second argument todependent()
.In the second example you have a callback function, so
console.log()
is executed whenever thechange
event happens on the input element in question.Because the value has to be set in order to be editable.
Allan
Hello thanks a lot Allan.
I don't really understand your answer for my 2nd question. Could you please help me to find a example on the datable web site ?
I need to detect any event changing my individual.id field when my editor is open, but not when my editor is open.
Thanks a lot.
Lionel
Sorry.
I need to detect when I input a new value in individual.id field or when the values is changed by another field, but not when my editor is open.
Thanks a lot.
Lionel
Try:
I'm with you now.
dependent()
doesn't provide that information, but the above code does through the data parameter passed into the event handler.Allan