+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How difficult would it be to add additional columns to the new releated data dialog grids?

How difficult would it be to add additional columns to the new releated data dialog grids?

4 posts, 0 answered
  1. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    08 May 2014
    Link to this post

    The default grids show title, owner, modified and a view, edit, delete column.  I looked advanced settings and could not find anywhere where those would be exposed.  Looking through JustDecompile I found a few ascx and javascript templates using Kendo for related data, but it looks like I would need to override these files in quite a few spots.

     Is this something easier than what I am making it out to be?

     For instance I want to expose one of my modules fields to display in a column.

  2. Pavel Benov
    Pavel Benov avatar
    341 posts
    Registered:
    14 Mar 2016
    13 May 2014
    Link to this post
    Hi Stacey,

    The RelatedDataField control is relatively new and for the time being it is not easily extensible. You would start by overriding the field control and extending its client side:

    http://www.sitefinity.com/blogs/pavel-benov-s-blog/2013/12/11/extending-client-component-of-field-controls-in-sitefinity-cms

    In the Initialize function of the script we are using requireJs to reference the additional templates and scripts needed to power the related data grid in the dialog that pops up:

    requirejs.config({
                baseUrl: this._siteBaseUrl + "Res",
                paths: {
                    RelatedDataSelector: 'Telerik.Sitefinity.RelatedData.Web.UI.Scripts.RelatedDataSelector',
                    RelatedDataGrid: 'Telerik.Sitefinity.RelatedData.Web.UI.Scripts.RelatedDataGrid',
     
                    RelatedDataSelectorTemplate: 'Telerik.Sitefinity.RelatedData.Web.UI.Templates.RelatedDataSelector.sfhtml',
                    RelatedDataGridTemplate: 'Telerik.Sitefinity.RelatedData.Web.UI.Templates.RelatedDataGrid.sfhtml',
     
                    ContentSelectorBase: 'Telerik.Sitefinity.RelatedData.Web.UI.Scripts.ContentSelectorBase',
                    FlatContentSelector: 'Telerik.Sitefinity.RelatedData.Web.UI.Scripts.FlatContentSelector',
                    FlatContentSelectorTemplate: 'Telerik.Sitefinity.RelatedData.Web.UI.Templates.FlatContentSelector.sfhtml',
     
                    DetailViewEditingWindow: 'Telerik.Sitefinity.Web.RequireJSModules.Scripts.DetailViewEditingWindow',
                    ContentRepository: 'Telerik.Sitefinity.Web.UI.PublicControls.InlineEditing.Scripts.ContentRepository'
                },
                map: {
                    '*': {
                        text: this._siteBaseUrl + "ExtRes/Telerik.Sitefinity.Resources.Scripts.RequireJS.text.js",
                    }
                },
                waitSeconds: 0
            });

    The RelatedDataGrid.sfhtml is the template of the grid control which you need to customize and add a custom column.

    The RelatedDataSelect is the javascript file that powers this grid and where you need to set the visible columns of the grid you would like:

    relatedDataGridOptions.visibleColumnKeys = ["AllowMultiple", this.options.relatedTypeIdentifierField, "LastModified", "Owner", "Edit", "Preview"];

    All this however would not work without extending the 2 services (GenericDataService and RelatedDataService) that deliver the dynamic data to the grid. Currently those services bring only standard fields like Owner, DateCreated, Url etc. and they lack implementation to transfer custom fields data.

    Regards,
    Pavel Benov
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    13 May 2014 in reply to Pavel Benov
    Link to this post

    I thought that might be the case.  Thanks for getting back to me with the information you posted.  I am making the assumption, assuming other developers have a need for this, that additional iterations of the new related data functionality will eventually expose an easier way to extend those grids?

  4. Pavel Benov
    Pavel Benov avatar
    341 posts
    Registered:
    14 Mar 2016
    14 May 2014
    Link to this post
    Hello Stacey,

    Yes, there are plans for further enhancing the control and making it more extensible, but for the time being I cannot provide any estimates. On a side note we are going to work on a sample and post an online resource that will provide more details on extending the control.

    Regards,
    Pavel Benov
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 0 answered