Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Yanick Van Barneveld 27 posts 148 karma points
    Nov 03, 2016 @ 09:46
    Yanick Van Barneveld
    0

    UIOMaticField Dropdown one-to-one

    Hi again,

    I am trying to create a dropdown and I am using the Dogs example. It just has to be a simple one-to-one relation.

    To create the dropdown I am having the following code:

    [UIOMaticField(Name = "Owner", Description = "Select the owner of the dog", View = "dropdown", Config = "{'typeName': 'Example.Member, Example', 'valueColumn': 'Id', 'sortColumn': 'Firstname', 'textTemplate' : 'Firstname'}")]
    public int MemberId { get; set; }
    

    My Member POCO is looking like this:

    using System.ComponentModel.DataAnnotations;
    using UIOMatic.Attributes;
    using UIOMatic.Enums;
    using Umbraco.Core.Persistence;
    using Umbraco.Core.Persistence.DatabaseAnnotations;
    
    namespace Example
    {
    [UIOMatic("member", "Members", "Member", FolderIcon = "icon-users", ItemIcon = "icon-user", RenderType = UIOMaticRenderType.List)]
    [System.Web.DynamicData.TableName("Member")]
    public class Member
    {
        [UIOMaticListViewField, PrimaryKeyColumn(AutoIncrement = true)]
        public int Id { get; set; }
    
        [Required]
        [UIOMaticField(Name = "Username", Description = "Enter the users username")]
        public string Username { get; set; }
    
        [Ignore]
        [UIOMaticListViewField(Name = "Naam")]
        public string Name { get { return Firstname + " " + Lastname; } }
    
        [Required]
        [UIOMaticField(Name = "Firstname", Description = "Enter the users firstname")]
        public string Firstname { get; set; }
    
        [Required]
        [UIOMaticField(Name = "Lastname", Description = "Enter the users lastname")]
        public string Lastname { get; set; }
    
        [Required]
        [UIOMaticListViewField(Name = "Emailadres"), UIOMaticField(Name = "Mailaddress", Description = "Enter the users mailaddress")]
        public string Mailaddress { get; set; }
    
        [Required]
        [UIOMaticListViewField(Name = "Werkmaatschappij"), UIOMaticField(Name = "Company", Description = "Enter the users working company")]
        public string Company { get; set; }
    }
    }
    

    I am getting the following error in the frontend:

    Server error: Contact administrator, see log for full details.
    Failed to get all
    

    Not very much information in my logs only this:

        _shutDownStack=   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
       at System.Environment.get_StackTrace()
       at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
       at System.Web.Hosting.HostingEnvironment.InitiateShutdownWithoutDemand()
       at System.Web.HttpRuntime.ShutdownAppDomain(String stackTrace)
       at System.Web.HttpRuntime.OnCriticalDirectoryChange(Object sender, FileChangeEvent e)
       at System.Web.FileChangesMonitor.OnCriticaldirChange(Object sender, FileChangeEvent e)
       at System.Web.DirectoryMonitor.FireNotifications()
       at System.Web.Util.WorkItem.CallCallbackWithAssert(WorkItemCallback callback)
       at System.Web.Util.WorkItem.OnQueueUserWorkItemCompletion(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
       at System.Threading.ThreadPoolWorkQueue.Dispatch()
    

    I can't find out what I am doing wrong. I created for the MemberId a foreign key in the database to the Member table.

    Can you people help me out? :)

    Kind regards, Yanick

    Edit: The example I am following is: http://www.nibble.be/?p=496

  • Tim Geyssens 6416 posts 15012 karma points MVP 2x c-trib
    Nov 03, 2016 @ 10:00
    Tim Geyssens
    101

    Hi Yanick, I suppose you are using UI-O-Matic v2? That example is for v1 and the config setting have slightly changed

    So it is the type alias you need to provide and also the texttemplate has to be in Angular syntax so {{Firstname}}

    http://uiomatic.readthedocs.io/en/stable/02.DefaultEditorViews/#dropdown

    [UIOMaticField(Name = "Owner", Description = "Select the owner of the dog", View = UIOMatic.Constants.FieldEditors.Dropdown, Config = "{'typeAlias': 'member', 'valueColumn': 'Id', 'sortColumn': 'Firstname', 'textTemplate' : '{{Firstname}}'}")]
    public int MemberId { get; set; }
    
  • Simon 687 posts 1061 karma points
    Mar 10, 2017 @ 13:22
    Simon
    0

    Can you please update the documentation, regarding this.

  • Tim Geyssens 6416 posts 15012 karma points MVP 2x c-trib
    Mar 10, 2017 @ 13:24
    Tim Geyssens
    0

    Hmm aren't they up to date here? http://uiomatic.readthedocs.io/en/stable/

    Also if you feel up to it you can always provide a pull request with the changes you think required :)

  • Marco Teodoro 2 posts 71 karma points
    Jun 27, 2017 @ 16:38
    Marco Teodoro
    0

    Hi @Tim,

    it's the first time i'm using uiomatic and looks awesome. Great plugin really, i can image several customer that will request this after i'm preparing a demo, witch i'm trying to do with no luck so far :) that's why i'm replaying to this post.

    i've took a look at docs, they look great also but i'm struggling to make the dropdown work. Can you help please?

    i'm trying to use a dropdown to relate a child entity to it's parent. I've created the sql tables and the corresponding entities: main entity is Setor and child entity Atividade.

    This is the property IdSetor that relates the child entity to it's parent:

        [UIOMaticField(Description = "Selecione o Setor de actuação da empresa", View = UIOMatic.Constants.FieldEditors.Dropdown,
                Config = "{'typeAlias': 'Setor', 'valueColumn': 'Id', 'sortColumn': 'Nome', 'textTemplate' : '{{Nome}}")] 
    public int IdSetor { get; set; }
    

    and the parent entity is this:

     [TableName("Setores")]
    [UIOMatic("Setor","Setores", "Setor", FolderIcon = "icon-documents", ItemIcon = "icon-document")]
    public class Setor
    {
        [PrimaryKeyColumn(AutoIncrement = true)]
        public int Id { get; set; }
    
        [UIOMaticField(Name = "Name", Description = "Nome em Inglês", View = "textfield")]
    
        public string Name { get; set; }
    
        [UIOMaticField(Name = "Nome", Description = "Nome em Português", View = "textfield")]
        public string Nome { get; set; }
    }
    

    I can create the main entity with UIOMatic but i can't open the editor to create the child entity.

    i've this error : )]}', {"Message":"An error has occurred.","ExceptionMessage":"Exception while creating a value.","ExceptionType":"System.Exception","StackTrace":" at Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding, CacheItemPriority priority, CacheItemRemovedCallback removedCallback, CacheDependency dependency)\r\n at Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem)\r\n at Umbraco.Core.Cache.DeepCloneRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem)\r\n at UIOMatic.Services.PetaPocoObjectService.GetTypeInfo(Type type, Boolean populateProperties)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.

    exception while opening the editor to create child entity

  • Tim Geyssens 6416 posts 15012 karma points MVP 2x c-trib
    Dec 17, 2018 @ 08:08
    Tim Geyssens
    0

    So the dropdown populates correctly? Or which part isn't working, from what I can see the config is ok...

Please Sign in or register to post replies

Write your reply to:

Draft