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

Forums / Thunder / Thunder and auto-generated designer

Thunder and auto-generated designer

12 posts, 1 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    24 Jul 2012
    Link to this post
    The page selector thunder generates for us...lets the user select a page, but doesn't let them clear that selection?

    (I know now a thunder issue per-say, but, thoughts?)
  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    24 Jul 2012
    Link to this post
    Also, is something missing??  I have about 4 page selectors on the page and when the designer loads back up, they don't re-load in their saved page into the selector

    **EDIT** Interesting note...the LAST page selector populates perfectly fine going back in
  3. Marin Atanasov
    Marin Atanasov avatar
    62 posts
    Registered:
    24 Sep 2012
    25 Jul 2012
    Link to this post
    Hello Steve,

    Thank you for bringing this up. We will add it for the next release. If you want to do it manually, here is what you need to add to the javascript of the designer:

    1. Clearing the page selection. Replace <PropertyName> with the name of the property for the page selector.
    _pageSelected<PropertyName>Handler: function (items) {
        ...
        var selectedPage = pagesSelector.get_selectedItem();
        if (selectedPage) {
            ...
        }
        else {
            jQuery(this.get_selected<PropertyName>Label()).hide();
            this.get_pageSelectButton<PropertyName>().innerHTML = '<span>Select</span>';
            controlData.<PropertyName> = "00000000-0000-0000-0000-000000000000";
        }
    },

    2. The guid properties are populated but the javascript doesn't reflect them when having several page selectors.
    Go to the refreshUI function in the designer's javascript. The issue comes from the fact that every page selector creates variables with the same name: pagesSelector, selectedPageLabel and selectedPageButton. Change the names of the variables for every one of these blocks:
    if (controlData.<PropertyName> && controlData.<PropertyName> !== "00000000-0000-0000-0000-000000000000") {
        var pagesSelector = this.get_pageSelector<PropertyName>().get_pageSelector();
        var selectedPageLabel = this.get_selected<PropertyName>Label();
        var selectedPageButton = this.get_pageSelectButton<PropertyName>();
        pagesSelector.add_selectionApplied(function (o, args) {
            var selectedPage = pagesSelector.get_selectedItem();
            if (selectedPage) {
                selectedPageLabel.innerHTML = selectedPage.TitlesPath;
                jQuery(selectedPageLabel).show();
                selectedPageButton.innerHTML = '<span>Change page</span>';
            }
        });
        pagesSelector.set_selectedItems([{ Id: controlData.<PropertyName>}]);
    }

    I am sorry for the caused inconvenience. Please let me know if you have further questions regarding the page selector.

    Regards,
    Marin Atanasov
    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
  4. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    25 Jul 2012
    Link to this post
    Ok, so I appended a number to each variable, reloaded...and now when I click select page, nothing shows up in the picker, doesn't filter or anything :/ ?  I reverted versions and I'm going to try it again on one or two...

    Why is it that the variables exist outside of each if statement?  Is that some JS wierdness?  Isn't it okay once scope is defined?
  5. Marin Atanasov
    Marin Atanasov avatar
    62 posts
    Registered:
    24 Sep 2012
    26 Jul 2012
    Link to this post
    Hello Steve,

    When changing the name of the variable, please make sure that you change the name wherever it is used in the same if statement:
    if (controlData.<PropertyName> && controlData.<PropertyName> !== "00000000-0000-0000-0000-000000000000") {
        var pagesSelector = this.get_pageSelector<PropertyName>().get_pageSelector();
        var selectedPageLabel = this.get_selected<PropertyName>Label();
        var selectedPageButton = this.get_pageSelectButton<PropertyName>();
        pagesSelector.add_selectionApplied(function (o, args) {
            var selectedPage = pagesSelector.get_selectedItem();
            if (selectedPage) {
                selectedPageLabel.innerHTML = selectedPage.TitlesPath;
                jQuery(selectedPageLabel).show();
                selectedPageButton.innerHTML = '<span>Change page</span>';
            }
        });
        pagesSelector.set_selectedItems([{ Id: controlData.<PropertyName>}]);
    }


    Javascript variables do not have such a thing as a block scope. They are visible for the whole function. You can find more information about the scope of the javascript variables here.

    All the best,
    Marin Atanasov
    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
  6. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    26 Jul 2012
    Link to this post
    Yep, used replace in selection, find it attached

    This is the line that's null
    var selectedPage1 = pagesSelector1.get_selectedItem();
    (selectedPage1 is null)

    https://dl.dropbox.com/u/3234184/Temp/Resources.zip
  7. Marin Atanasov
    Marin Atanasov avatar
    62 posts
    Registered:
    24 Sep 2012
    26 Jul 2012
    Link to this post
    Hello Steve,

    The designer worked just fine when I set it up. I attached the widget. Paste it in your Medportal project so that the namespaces match, make Embedded Resource everything but the .cs files and give it a try.

    I commented 1 line that was trying to find a code that wasn't included in the sample. Also, I changed the designer to use LayoutTemplatePath instead of LayoutTemplateName. LayoutTemplateName is obsolete and it shouldn't be used anymore. Just use LayoutTemplatePath with the virtual path for your class library.

    Please let me know if you have further questions regarding this issue.

    Regards,
    Marin Atanasov
    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
  8. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    26 Jul 2012
    Link to this post
    Isn't layout template path used for a control in your SitefinityWebApp and layout name used for a control in an external assembly?
  9. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    27 Jul 2012
    Link to this post
    I think the path was it...I just changed that, then it works again, thanks!
  10. Marin Atanasov
    Marin Atanasov avatar
    62 posts
    Registered:
    24 Sep 2012
    27 Jul 2012
    Link to this post
    Hello Steve,

    LayoutTemplateName is obsolete. It should return null.

    For SitefinityWebApp, you use layout template path with the relative path to your template.
    For an external assembly, you use layout template path to an embedded .ascx template using the virtual path that your SitefinityWebApp is using for your external assembly.
    Sitefinity Thunder follows those rules when creating widgets/designers.

    I mentioned it because the widget that you sent me was using layout template path with the virtual path, but your widget designer was using layout template name. 

    Kind regards,
    Marin Atanasov
    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
  11. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    20 Sep 2012
    Link to this post
    Was this issue with not showing the selected page already resolved? I'm still not seeing the selected page when reopening the designer.

    Or should I customize my code somewhere?

    Cheers,
    Daniel
  12. Marin Atanasov
    Marin Atanasov avatar
    62 posts
    Registered:
    24 Sep 2012
    20 Sep 2012
    Link to this post
    Hello Daniel,

    This issue has been fixed in Sitefinity Thunder. However, this means that the newly generated designers will have this functionality. Any designers that have been generated with older versions of Thunder will need to be changed or generated from scratch.

    If you have not added any custom logic to the designer, I would suggest removing the attribute from the control and optionally, delete the designer. Then build the project and generate a new designer for the control. Build the project again afterwards.

    If you have custom logic which you do not want to lose, I would suggest generating a new designer without deleting the current one. Then compare the .cs, .js and .ascx files for any changes and add those changes to your original designer. Change the designer attribute to point back to the original designer and delete the newly generated one when you are done. Build the project and you should be good to go.

    I apologize that I cannot give you exact details on what you need to change to get it to work, but the generated page selector has been updated several times since release and I do not know which version of Thunder you were using to generate the original page selector.

    If you are unable to get it to display the selected page's name, I would suggest opening a ticket and attaching the widget and designer files so that we can help you add this functionality manually.

    All the best,
    Marin Atanasov
    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
12 posts, 1 answered