Editor .dependent() and multi-row editting.
Editor .dependent() and multi-row editting.
HassanDomeDenea
Posts: 29Questions: 10Answers: 0
in Editor
Greetings.
The simple dependent example can use a json like this to update the field (item_price) value:
return {
values: {
"item_price": "100"
}
}
let's suppose we have selected two rows for editting.
What json can I supply for the dependent function to set distinct value for each record ? for suggestion to edit the records of id 5 and 6:
return {
values: {
"item_price": {
"5":"100",
"6" "125",
}
}
}
The above example doesn't work. So how to use this correctly if it was possible ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Currently I'm afraid it isn't possible. At this time the
values
object thatdependent()
accepts is singular (i.e. one value for all field's being edited).To work around that you'd need to add an
input
/change
event to the input element you want to listen for changes from and then usefield().multiSet()
once the values have been retrieved from Ajax (i.e. basically the same asdependent()
does, but with a little extra processing for the multi-rows).Allan
I see.
I also put a simple workaround, by checking the length of the (rows) array, and skipping the dependent function entirely if they were more than 1. (Which satisfied my needs), because I don't want to edit them anyway.
If someone desired to edit them (to single value), maybe he can check if all the records of the (rows) array having that field are equal (which meanse, single value at the end).