Dropdown to display one field and update another
Dropdown to display one field and update another
I have a dropdown that is populated depending on a part number:
editor.dependent( 'salstkmaster.partnum', function ( val, data, callback ) {
$.ajax( {
url: 'datatables.php',
data: { action: "supplier", value: val },
type: 'POST',
dataType: 'json',
success: function ( json ) {
callback( json );
}
});
});
This uses the salstkitem.supplier field, and lets imagine it produces the following:
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
How can I get this field to update the enqitem.itemid field? Rather than salstkitem.supplier?
I have tried adding the following to my DataTable:
{ data: "salstkitem.supplier", editField: "enqitem.itemid" }
But this stops the dropdown from working. Any ideas?
If more information is required I can provide it, I just tried to cut stuff out for brevity.
This question has an accepted answers - jump to answer
Answers
What fields the callback on the
dependent()method perform depends entirely on the JSON that you are sending back. e.g. to change the options inenqitem.itemidyou would use a JSON structure such as:Allan