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

Forums / Project Feather / Widget Designer Read From Database/Controller

Widget Designer Read From Database/Controller

6 posts, 0 answered
  1. Zack
    Zack avatar
    3 posts
    Registered:
    03 Oct 2013
    02 Mar 2015
    Link to this post

    Hello,

    I'm in the process of writing a custom widget, and was wondering if it was possible for the widget designer to read values from a database/controller?

    Thanks,

    Zack

  2. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    26 Sep 2016
    05 Mar 2015
    Link to this post
    Hi Zack,

    Basically, you add a property to the widget. Then from the designer, you have the ability to get and set it. The new property value is persisted in the database through the designer. If you change the property from the widget itself, it will not save - you can only 'consume' it from the widget.
    You can find the following resources useful:
    http://www.sitefinity.com/developer-network/videos/how-to-create-a-sitefinity-widget
    http://docs.sitefinity.com/for-developers-create-a-custom-widget-with-a-simple-widget-designer
    http://docs.sitefinity.com/overview-user-and-custom-widgets

    Regards,
    Nikola Zagorchev
    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. Zack
    Zack avatar
    3 posts
    Registered:
    03 Oct 2013
    20 Mar 2015
    Link to this post

    Hi Nikola,

     

    Thanks for your reply, I don't think I explained myself well enough. I'm creating a Feather widget, and would like the widget designer to consist of values (in drop down lists) pulled in from a database, either through (hopefully) a controller in the MVC project or an outside service if necessary.

    Thanks,

    Zack

  4. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    26 Sep 2016
    20 Mar 2015
    Link to this post
    Hello Zack,

    You can review how to override default widgets designer here:
    https://github.com/Sitefinity/feather/wiki/Extend-widget-designer-with-additional-client-logic
    or create a custom view:
    https://github.com/Sitefinity/feather/wiki/Create-a-custom-designer-view

    Here is a list of the content selectors:
    Use Content Selectors
    News selector
    Page selector
    Multisite page selector
    Flat taxon selector
    Hierarchical taxon selectorDynamic items selector
    DateTime picker
    TimeSpan selector
    Language selector
    Link selector
    Site selector
    Use a single content item selector
    Use a multiple content item selector
    Use a library selector
    Use an image selector
    Use a document selector
    Use a role selector
    Use content selectors in your frontend pages
    List of selectors scripts

    You can read the documentation about them and reuse them or create a custom one based on them. You can review the base selectors and scripts
    sf-selectors.js 
    sf-services.js
    Hope this is useful.

    Regards,
    Nikola Zagorchev
    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
     
  5. Balu
    Balu avatar
    3 posts
    Registered:
    11 Apr 2014
    18 May
    Link to this post
    Hi Nikola,

    I have updated the values when saving the form. Still I am facing the same issue.


    I am setting the property values as below.

    propertyService.get()
                .then(function (data) {
                    if (data) {
                        $scope.properties = propertyService.toAssociativeArray(data.Items);
                        $scope.properties.CorticonEntityName.PropertyValue = newVal;
                        $scope.properties.CorticonFieldName.PropertyValue = newVal;
                    }

                    return $http.get("http://corticon-demo.dyndns.org:8850/axis/corticon/getVocabulary/Sitefinity_CoveredCA/3/0");
                },

  6. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    26 Sep 2016
    18 May
    Link to this post
    Hi Balu,

    This is the get function when you get the properties values from the service. You need to either bind to the $scope.properties.CorticonFieldName.PropertyValue directly or use a $watch.
    The code you have pasted is not called on Save of the designer, but on open.

    Regards,
    Nikola Zagorchev
    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
     
6 posts, 0 answered