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

Forums / Developing with Sitefinity / Allowing reordering of custom module items

Allowing reordering of custom module items

14 posts, 0 answered
  1. Antoine
    Antoine avatar
    45 posts
    Registered:
    13 Jul 2012
    25 Jul 2011
    Link to this post
    I have created a custom module and would like to enable the reordering of the module content items through the backend grid view (in the same manner that List Items can be modified).

    From what I can tell, I need to create an ordinal field in the database table for my content item.  Then I need to add a drag & drop reordering column to my MasterGridViewElement.

    How do I do this?
  2. Mark
    Mark avatar
    147 posts
    Registered:
    01 Jun 2010
    26 Jul 2011
    Link to this post
    Check out App_Data/Sitefinity/Configurations/toolboxes.config

    I think you should be able to reorder them in the file and the changes will appear in the frontend.
  3. Antoine
    Antoine avatar
    45 posts
    Registered:
    13 Jul 2012
    26 Jul 2011
    Link to this post
    Thank you for the reply Mark.

    I am not trying to reorder the modules, but rather the content items that my custom module manages.
  4. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    26 Jul 2011
    Link to this post
    Hi Antoine,

    I presume you want to reorder the items( text fields, image upload, details, categories and tags). This is done in the Definitions file of your module. I will use Products module(available with Sitefinity SDK) as an example.
    In ProductsDefinitions.cs you will notice you have #region Main section,#region Categories and Tags and etc. Under the definition of the section elements are added from top to bottom. This is how they appear in the backend of the module.
    var titleField = new TextFieldDefinitionElement(mainSection.Fields) // Title of Product Item
    var dropDownTaxonomyField = new TaxonFieldDefinitionElement(mainSection.Fields) // the color selector
    var contentField = new HtmlFieldElement(mainSection.Fields) // the body where you enter product information

    To reorder the items in any way you like you can copy paste them to change positioning or create new section following the example of how the existing sections are defined.


    Kind regards,
    Stanislav Velikov
    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
  5. Antoine
    Antoine avatar
    45 posts
    Registered:
    13 Jul 2012
    26 Jul 2011
    Link to this post
    Actually, that is not what I meant.  I will attempt to be more clear.

    I have created a Contacts modules.  I would like to control the sort order of the contacts on the front end using the drag and drop functionality that is available in the Pages manager as well as the List module.

    I have attached a screenshot of the sorting mechanism in the List Items module as an example of what I want to implement in my module.

    Thank you for your response.
  6. FRANCISCO
    FRANCISCO avatar
    1 posts
    Registered:
    25 Aug 2011
    10 Nov 2011
    Link to this post
    There is not response to this post?
    This is a feature that I think a lot of developer would like to do instead of adding a manual order for the final user.


  7. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    14 Nov 2011
    Link to this post
    Hi Francisco,

    Sorting can be changed in the frontend widget of the module. Edit the widget advanced properties Home > ControlDefinition > Views > ProductsFrontendList and change SortExpression. Or in the code of the module in MasterListView
    CultureInfo uiCulture = null;
                   if (AppSettings.CurrentSettings.Multilingual)
                   {
                       uiCulture = System.Globalization.CultureInfo.CurrentUICulture;
                   }
                   //the filter is adpated to the implementation of ILifecycleDataItemGeneric, so the culture is taken in advance when filtering published items.
                   this.FilterExpression = ContentHelper.AdaptMultilingualFilterExpression(this.FilterExpression);
                   var filterExpression = DefinitionsHelper.GetFilterExpression(this.FilterExpression, this.AdditionalFilter);
                   query = Telerik.Sitefinity.Data.DataProviderBase.SetExpressions(
                       query,
                       filterExpression,
                       "Title ASC",
                       uiCulture,
                       itemsToSkip,
                       masterDefinition.ItemsPerPage,
                       ref totalCount);

    Concerning the drag and drop functionality, there is no sample available. In Sitefinity this is achieved on the client with javascript events of RadGrid used to list all module items.

    Greetings,
    Stanislav Velikov
    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
  8. Jason Chester
    Jason Chester avatar
    11 posts
    Registered:
    03 Feb 2010
    16 Nov 2011
    Link to this post
    I would also like to express my interest for a Sitefinity example that implements ordering the Sitefinity way.

    Until this exists, I have decided to create the Ordinal field as a Float on my content items.

    [DataMember]
    public float Ordinal { get; set; }

    I then expose the ordinal for editing on the content editor form.

    var ordinalField = new TextFieldDefinitionElement(mainSection.Fields)
    {
        ID = "ordinalFieldControl",               
        DataFieldName = "Ordinal",
        DisplayMode = displayMode,
        Title = "Ordinal",
        CssClass = "sfTitleField",
        ResourceClassId = typeof(PromotionsResources).Name,
        WrapperTag = HtmlTextWriterTag.Li
    };
    ordinalField.ValidatorConfig = new ValidatorDefinitionElement(ordinalField)
    {
        Required = true,
        MessageCssClass = "sfError",
        RequiredViolationMessage = Res.Get<PromotionsResources>().OrdinalCannotBeEmpty
    };
    mainSection.Fields.Add(ordinalField);

    While this is not the desired experience, I am hoping when a sample that implements custom ordering becomes available it will be easy to implement since the backend is already available.

    Here is another post about ordering of custom content items that is a little more helpful but still not a usable example of how to implement.

    http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/how-to-implement-moving-of-items-up-and-down.aspx 

    JASON CHESTER

    Technology Director

    rosetta.com




  9. Firewater
    Firewater avatar
    5 posts
    Registered:
    24 Aug 2011
    19 Jun 2013 in reply to Jason Chester
    Link to this post
    I would still love to see this feature available to the custom modules.

    It is present in the pages module and we need a simplified version of it to prioritise records. eg: in the case of a contact list, drag and drop people so the most important person is at the top of the list. At present we just use a numeric field that is manually edited to achieve the desired output on the front-end but for back-end administration it is far from desirable to drag and drop contacts in order.
  10. Beth
    Beth avatar
    25 posts
    Registered:
    20 Aug 2012
    20 Sep 2013
    Link to this post
    If we can drag and drop order for the pages why can we not turn it on elsewhere? 
  11. Pavel Benov
    Pavel Benov avatar
    341 posts
    Registered:
    14 Mar 2016
    25 Sep 2013
    Link to this post
    Hello,

    The ordering on page level is available since there is a property called Ordinal for the PageNodes. This property is used to track a page's location in the tree view and it is recalculated each time a page is moved from its location. Additionally as page list actually uses Tree view to display the pages, the dynamic modules use Grid for which there is no drag & drop ordering functionality. We have a PITS issue opened for this feature request so you can follow its progress and vote to increase its popularity. 

    You can set a sorting expression for the view from Administration->Settings->Advanced->DynamicModules->Controls->your module->Views->YourModuleBackendList using the Sort Expression field.

    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 Public Issue Tracking system and vote to affect the priority of the items
  12. kamii47
    kamii47 avatar
    71 posts
    Registered:
    02 Mar 2007
    15 May 2014 in reply to Pavel Benov
    Link to this post

    Where is the PITS issue? Same problem in SF that requested feature in 2011 is still not there in 2014

     

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

    You can find this feature request available on the following url:

    http://feedback.telerik.com/Project/153/Feedback/Details/100801-module-builder-drag-drop-ordering-on-backend-list

    Please cast your vote up to increase its popularity and subscribe for automatic notifications.

    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
     
  14. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    22 Nov in reply to Pavel Benov
    Link to this post

    Edit: Apologies, I forgot to switch to the List settings view and select "Sort as set manually"

     

    @PavelBenov

    Was this feature ever implemented? 

    And to be clear: Are we talking about creating the custom module then on a page you drag and drop the generated widget onto the page and on then you click Edit > Content > Select _content type_, then you select a bunch of your custom items in the 'Select _content type_' dialog and finally in the 'Selected' tab of the same dialog you can drag items into the order that you desire? 

    If it is, then the functionality seems to be there, but Sitefinity doesn't seem to adhere to the order you specify...  
    The designer/backend editing view seems to keep the order you specified between page edits, but the front end view doesn't. 

14 posts, 0 answered