TimGeyssens / UIOMatic

Auto generate an integrated crud UI in Umbraco for a db table based on a petapoco poco (and more)
https://timgeyssens.gitbook.io/ui-o-matic/
Other
67 stars 54 forks source link

Update item not able to select the selected value for dropdown field #192

Closed merly-cortez closed 2 years ago

merly-cortez commented 3 years ago

Hi,

Been searching the documentation and I believe have set up my column correctly. But opening the Update Item form doesn't select the selected item in the dropdown correctly. Please see as in attached.

Here's my column definition: [UIOMaticListViewField(Name = "Suburb", View = UIOMatic.Constants.FieldViews.Label)] [UIOMaticField(Name = "Suburb", Description = "Select the suburb", View = UIOMatic.Constants.FieldEditors.Dropdown, Config = "{'typeAlias': 'ekeSuburb', 'valueColumn': 'Id', 'sortColumn': 'Name','textTemplate' : '{{Name}}' }")] public int SuburbId { get; set; }

Here's my type definition: [UIOMatic("ekeSuburb", "Suburbs", "Suburb", FolderIcon = "icon-location-nearby", ItemIcon = "icon-location-nearby", RenderType = UIOMatic.Enums.UIOMaticRenderType.List)] [TableName("ekeSuburb")] public class Suburb {

    [PrimaryKeyColumn(AutoIncrement = true)]
    public int Id { get; set; }

    [Required]
    [UIOMaticListViewField]
    [UIOMaticField(Name = "Name", Description = "Enter the name of the suburb")]
    public string Name { get; set; }
}

image

toliphant commented 2 years ago

@merly-cortez I was having the same issue. I adjusted the dropdown view and changed value to ng-value around the ng-repeat. My selected options are now showing up just fine.

<div ng-controller="UIOMatic.FieldEditors.Dropdown">
    <select name="select" id="" ng-model="property.value">
        <option value="">---Please select---</option>
        <option ng-repeat="item in items track by item.value" ng-value="{{item.value}}">{{item.text}}</option>
    </select>
</div>