More in this section

Forums / Developing with Sitefinity / Column in the main module grid to expose taxonomy value

Column in the main module grid to expose taxonomy value

3 posts, 1 answered
  1. Denis
    Denis avatar
    105 posts
    Registered:
    27 Feb 2009
    05 Jan 2013
    Link to this post

    My custom module has taxonomy field (similar to 'Colors' in products sample).
    In order to add column to the grid to show taxonomy value I added property to the ItemViewModel class:

    public string Color
    {
        get { return this.color; }
        set { this.color = value; }
    }

    And I read taxonomy value in the contractor:

    System.Guid typeTaxa = ((Telerik.OpenAccess.TrackedList<System.Guid>)contentItem.GetValue("Color"))[0];
                type = TaxonomyManager.GetManager().GetTaxon(typeTaxa).Name;

    Also I added new column to the Grid that is binded to the new property.

    One thing makes me worry:
    New property is not really property, it is taxonomy. It is created only as a binding point. So I don't really need setter on this property. Omitting setter breaks functionality.

    Is this OK to have setter that doesn't do anything. Please let me know.

    Thanks!

  2. Jen Peleva
    Jen Peleva avatar
    568 posts
    Registered:
    10 Nov 2016
    08 Jan 2013
    Link to this post
    Hi Denis,

    No, having a setter will not cause any problems. The reason we're adding the get and set is so that the service, which displays the values in each column will have access over the property  or in this case dynamic property. You have probably seen this blog post, but in case you haven't, you might find it useful:

    http://www.sitefinity.com/blogs/lubomir-velkovs-blog/2012/01/22/extending_the_built-in_content_modules 

    Greetings,
    Jen Peleva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Denis
    Denis avatar
    105 posts
    Registered:
    27 Feb 2009
    09 Jan 2013 in reply to Jen Peleva
    Link to this post
    Hi Jen,

    thank you for confirming. That is what I thought.

    Denis.
3 posts, 1 answered