xOnXCell_Edit_SubmitValue_ToItem method

dynamic xOnXCell_Edit_SubmitValue_ToItem(
  1. XFDataItem itemInEdit,
  2. XCol xCol,
  3. dynamic newValue,
  4. bool valueIsChanged, {
  5. dynamic valueForResolved = null,
  6. dynamic valueForRealCol = null,
})

only itemInEditxCol.colKey = value!;

Implementation

xOnXCell_Edit_SubmitValue_ToItem(XFDataItem itemInEdit, XCol xCol, dynamic newValue, bool valueIsChanged, {dynamic valueForResolved = null, dynamic valueForRealCol = null}) {
  if (newValue is XEnumDef) {
    itemInEdit[xCol.colKey] = newValue.value;
  } else {
    if (newValue is String) {
      newValue.trim();
    }
    // ID & _resolved
    if (xCol.colKey.endsWith("_resolved")) {
      if (valueForResolved != null) {
        itemInEdit[xCol.colKey] = valueForResolved!;
      }
      if (valueForRealCol != null) // parte del campo vero, senza _resolved
      {
        itemInEdit[xCol.colKey.replaceAll("_resolved", "")] = valueForRealCol!;
      } else {
        itemInEdit[xCol.colKey] = newValue;
      }
    } else {
      itemInEdit[xCol.colKey] = valueForRealCol ?? newValue;
    }
  }
}