Is it possible to pass custom select options to Editor for each row in DataTable?
Is it possible to pass custom select options to Editor for each row in DataTable?
I have a field that needs to have different select options in the Editor window, for each row in the DataTable.
Here is a sample of the data structure that I want to use to populate the select options.
"product_uom_collection": [{
"unit_of_measure": "CS",
"unit_size": "12.0000",
"unit_description": "Case"
},
{
"unit_of_measure": "EA",
"unit_size": "1.0000",
"unit_description": "Each"
},
{
"unit_of_measure": "PC",
"unit_size": "1.0000",
"unit_description": "Piece"
}]
Option label should use "unit_description" field, and value should use "unit_of_measure" field.
The "product_uom_collection" array varies per row, so I need to be able to have the options dynamically change to reflect the valid values for each DataTable row.
Please advise if this is possible, and how to achieve.
This question has an accepted answers - jump to answer
Answers
Hi,
Thanks for the question! Is the
product_uom_collection
property part of the row data? If so, what you could do is this:That uses:
initEdit
to know when a row is being editedupdate()
-select
- to update the optionsYou might need to do something similar on create, depending on how you want to handle that.
Regards,
Allan
That worked perfectly.
Thank you. :-)