Fixed issue where modified SQL not loading Unique Constraint dialog. Fixes #6772

This commit is contained in:
Aditya Toshniwal 2021-09-23 14:47:31 +05:30 committed by Akshay Joshi
parent 9179b7464b
commit 0e6794f2f5

View File

@ -115,13 +115,14 @@ export default class UniqueConstraintSchema extends BaseUISchema {
allowClear:false,
multiple: true,
formatter: {
fromRaw: (backendVal)=>{
fromRaw: (backendVal, allOptions)=>{
/* remove the column key and pass as array */
return (backendVal||[]).map((singleVal)=>singleVal.column);
let optValues = (backendVal||[]).map((singleVal)=>singleVal.column);
return _.filter(allOptions, (opt)=>optValues.indexOf(opt.value)>-1);
},
toRaw: (value)=>{
/* take the array and convert to column key collection */
return (value||[]).map((singleVal)=>({column: singleVal}));
return (value||[]).map((singleVal)=>({column: singleVal.value}));
},
},
},