Custom Property Editor Dropdown not saving selected value
I have been trying to build a custom property editor based on the dropdown.
I have managed to get it to build with a set of options based on a prevalues field, and when I edit the document with this editor, I see all the drop down options, but having selected one and saved the document, it does not save my selection. (I checked the back end db, and no value is being written)
<select ng-model="model.value" ng-options="opt.id as opt.value for opt in model.config.myOptions">
<option></option>
</select>
Do I need to somehow bind them to the model?
ps just tested, if I hard code the options in the view it works fine. Hmm.....what do I do next!
UPDATE
Just can't fix this. I have noticed as soon as I save a document having selected an option, it reverts to none selected, so it must be something to do with the binding.
<li ng-repeat="option in model.config.myOptions">
<span><a ng-click="logOption(option)">{{option.Id}} - {{option.value}} </a></span>
</li>
You'll see there is no id property stored for them in the model.config.myOptions...
and so your model.value never gets set to anything, and it appears not to be saving !!
so if you tweak your loop to be:
<select ng-model="model.value" ng-options="opt.value as opt.value for opt in model.config.myOptions">
</select>
Then the options in the dropdown should save as the model.value for the property, and when you revisit the page, the dropdown value will be set to the saved value...
Custom Property Editor Dropdown not saving selected value
I have been trying to build a custom property editor based on the dropdown.
I have managed to get it to build with a set of options based on a prevalues field, and when I edit the document with this editor, I see all the drop down options, but having selected one and saved the document, it does not save my selection. (I checked the back end db, and no value is being written)
I must be missing something?
code extracts...
package.manifest
...
...
view
Do I need to somehow bind them to the model?
ps just tested, if I hard code the options in the view it works fine. Hmm.....what do I do next!
UPDATE
Just can't fix this. I have noticed as soon as I save a document having selected an option, it reverts to none selected, so it must be something to do with the binding.
HELP!
Hi Tim
If you loop through you config options
You'll see there is no id property stored for them in the model.config.myOptions...
and so your model.value never gets set to anything, and it appears not to be saving !!
so if you tweak your loop to be:
Then the options in the dropdown should save as the model.value for the property, and when you revisit the page, the dropdown value will be set to the saved value...
regards
Marc
is working on a reply...