Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

ComboBoxItem that addUnknownValues but do not allowEmptyValue

$
0
0
Hello,

I am using a ComboBoxItem as a template for a ListGridField editor and I'd like to accept new distinct values (addUnknownValues = true) but disallowing empty value (tried: allowEmptyValue = false) with the "revert to original value" semantics.

Unfortunately, by reading the docs and code (_updateValue), it seems that setting allowEmptyValue to false has no effect when addUnknownValues is true. (suppressSave is always false in this condition).

Would it make sense for you to support that?

Something like replacing the current logic:
Code:

var suppressSave = !forceSave && !this._valuePicked && this.addUnknownValues == false;
if (suppressSave && this.allowEmptyValue && (value == "")) {
  suppressSave = false;
}

By this (obviously I'm totaly unaware of possible collateral effects):
Code:

var suppressSave;
if (forceSave || this._valuePicked) {
  suppressSave = false;
} else {
  suppressSave = !this.addUnknownValues || (value == "" && !this.allowEmptyValue);
}

If not, could you suggest a different approach to achieve that behavior?

Viewing all articles
Browse latest Browse all 4756

Trending Articles