update row w/ checkbox
update row w/ checkbox
antoniocib
Posts: 277Questions: 62Answers: 1
Good morning everyone,
I would like to create let's say a rule.
This is the table:
For example the user goes to change the date I want that if the checkbox is validated (so its value is 1) it must return to 0 zero automatically.
It can be done?
This question has an accepted answers - jump to answer
Answers
First you need to notice whether an Editor value has changed at all. The link below looks like a good solution but I would use "submitSuccess" to determine the new date value instead of "initSubmit" because you never know wether a submission will succeed on "initSubmit".
https://datatables.net/forums/discussion/49721/trigger-script-if-a-value-has-changed-in-a-field-between-when-editor-being-spawned-to-when-updated
Once you notice a change you can make an Editor submission or a proprietary ajax call to change the checkbox field value and then ajax reload it.
@rf1234 can you give me an example with submitSuccess?
You could also use
dependent()
- like this example here. There, if the office value is changed, the salary is set to $999,999 - you would do something similar with your checkbox.Colin
Okay Colin its great the example but:
@colin and @rf1234
I need to hidden the fields in modal, i try in this way but not works, how i do?
With my example, you can just add
field().hide()
after thefield().set()
, something like this:Colin
Thanks @colin works.