Thunder and auto-generated designer
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?)
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
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"
;
,
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>]);
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?
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
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
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
Isn't layout template path used for a control in your SitefinityWebApp and layout name used for a control in an external assembly?
I think the path was it...I just changed that, then it works again, thanks!
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
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
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