I would expect that setting data-value-primitive="false" will override default behavior, however it appears that it does not work unless value is initialized to object. I would be really surprises is this is expected behavior. Would you please elaborate on this.
3 Answers, 1 is accepted
By default valuePrimitive option is false. That being said, it will set the model field to the selected object. Could you please send us a code excerpt that demonstrate the problematic behavior you are referring to?
Please review the sample code that demonstrates this issue. As you can see from the sample, changing a selected value in the dropdown incorrectly changes the bound field. Based on documentaiton, the bound field should be maintained as a complex object when data-value-primitive is set to false.
Thank you for the repro demo. Indeed, when the value is a primitive value, the valuePrimitive option will not force the binding to set it to an object. This is current implementation approach and we do not have plans to change it for now.
Your demo changes the objects to numbers, because the custom get function returns "0" values instead of nulls. If we start returning nulls for "product" field, then the widget works as expected:
Please avoid returning primitive values when you would like to use objects.