I have a custom section which allows me to edit data in a custom table.
I have created a custom Umbraco.Dropdown data type for which I have added a number of prevalues.
How do I configure and insert this custom dropdown into my custom section edit view and save the value to the database?
I have added this to my edit.html:
<umb-control-group label="Category" description="Required - Select a category">
<select ng-options="item.id as item.value for item in model.categories" ng-model="person.categoryId" name="dropDownList"></select>
</umb-control-group>
Can someone tell me what i need to do to hook up the custom dropdown?
will populate the $scope.categoryDropdown object with the following JSON:
[{"alias":"categoryDropdown","label":"Text","view":"dropdown","config":{"items":{"1038":{"value":"Board of Directors","sortOrder":1},"1039":{"value":"Field Support","sortOrder":2},"1040":{"value":"Customer Service","sortOrder":3},"1041":{"value":"Laboratory","sortOrder":4},"1042":{"value":"Sustainability","sortOrder":5}}}}]
but i'm not sure how to get that data to populate a select element as well as save to the database.
well it's definitely a hack and i really wish someone would respond with the recommended approach to do this, but this worked for me:
<umb-control-group label="Category" description="Required - Select a category">
<select class="umb-editor umb-dropdown" ng-model="person.categoryName" required>
<option value="">-- Select a Category --</option>
<option ng-selected="person.categoryName == obj.value" value="{{obj.value}}" ng-repeat="obj in categoryDropdown[0].config.items">{{obj.value}}</option>
</select>
</umb-control-group>
Would be nice if Umbraco actually had documentation for building custom sections... i'm stuck with Googling things for hours to see how people "hack' the cms to make it work. disappointing.
using custom data type in custom section
I have a custom section which allows me to edit data in a custom table.
I have created a custom Umbraco.Dropdown data type for which I have added a number of prevalues.
How do I configure and insert this custom dropdown into my custom section edit view and save the value to the database?
I have added this to my edit.html:
Can someone tell me what i need to do to hook up the custom dropdown?
Thanks!
bump.
Anybody with experience building custom sections?
OK, i've gotten so far as to having access to the dropdown in my edit.controller.js file but i'm not sure how to get it into my edit.html view.
this code:
will populate the $scope.categoryDropdown object with the following JSON:
but i'm not sure how to get that data to populate a select element as well as save to the database.
can someone get me across the finish line here?
well it's definitely a hack and i really wish someone would respond with the recommended approach to do this, but this worked for me:
Would be nice if Umbraco actually had documentation for building custom sections... i'm stuck with Googling things for hours to see how people "hack' the cms to make it work. disappointing.
is working on a reply...