3

I have implemented tabbed renderings in a client site, but the window is too small causing the user to scroll to see all the tabs. I have looked in the SelectRendering.xml file, but that seems to be inside of the popup. Anyone know of the proper place to edit the renderings popup to make the window larger?enter image description here

Update 1

After some investigation., the width is coming back from an API call to the WebEditRibbon.aspx page.

http://SITE_URL/sitecore/shell/Applications/WebEdit/WebEditRibbon.aspx?sc_content=master&ribbonId=%7B570A52B6-6755-461A-8052-5B95EF766F74%7D&id=%7BEA0A499F-5304-4D12-AFAB-620A9EC33A2F%7D&dev=%7BFE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3%7D&db=master&mode=edit&url=%2F%3Fsc_mode%3Dedit%26sc_itemid%3D%257bEA0A499F-5304-4D12-AFAB-620A9EC33A2F%257d%26sc_lang%3Den%26sc_version%3D1%26sc_site%3Dwebsite&la=en&pageSite=website&version=1&sc_speakribbon=1

That returns this data. dialogWidth is what I need to track down.

"dialogWidth:1175px;dialogHeight:605px;help:no;scroll:auto;resizable:yes;maximizable:yes;closable:yes;......

3
  • We have something similar (tabbed rendering selector), we simply used CSS to make the tabs wrap onto a second line if there were too many. – jammykam Jan 18 '17 at 19:54
  • Can you add your Sitecore version please? – Koen Heye Jan 18 '17 at 21:51
  • 8.2 initial release – Chris Auer Jan 18 '17 at 21:52
4

I was intrigued by your question since I asked myself the same before. So I started investigating what happens when you click on 'Add here'.
It triggers a webedit command: addrendering.

If you look at the Sitecore.ExperienceEditor.config in the commands section, you'll find the following:

<command name="webedit:addrendering" type="Sitecore.Shell.Applications.WebEdit.Commands.AddRendering, Sitecore.ExperienceEditor" />

I haven't looked at all the code in the AddRendering class, but there was 1 line in the Run method that got my attention:

SheerResponse.ShowModalDialog(dialogUrl, "720px", "470px", string.Empty, true);

720px is the exact width of the Add rendering popup modal...

So I copied the class to a test project, overwrote 720 to something larger, and it worked!
Tested with Sitecore.NET 8.1 (rev. 160519)

Note: I do agree with jammykam, updating CSS is probably the easiest way

Note2: I noticed that the Insert Page dialog works differently. Insert Page is a SPEAK dialog, while Add Rendering is SHEER UI.
To change the width of the Insert Page dialog go to the Core database and navigate to: /sitecore/client/Applications/ExperienceEditor/Dialogs/InsertPage/PageSettings/DialogSettings

Core database path to insert page dialog

0

Thanks for the code Koen, your fix is the same fix that SXA uses to change the size of their dialog. So there is validity to your solution.

Here is what I came up with. Doesn't require modification of any Sitecore dll code. I use JavaScript to increase the size.

SelectRendering.xml

Here is my SelectRendering.xml. Notice I added a script link to a new js file called dialog.js. https://gist.github.com/dnstommy/6af6cd4905bd226ef7e1b01621c0cb18

<?xml version="1.0" encoding="utf-8" ?>
<control xmlns:def="Definition" xmlns="http://schemas.sitecore.net/Visual-Studio-Intellisense">
  <Sitecore.Shell.Applications.Dialogs.SelectRendering>
    <FormDialog ID="Dialog" Icon="Core/32x32/open_document.png" Header="Open Item"
      Text="Select the item that you wish to open. Then click the Open button." OKButton="Open">
      <Stylesheet Src="SelectItemWithThumbnails.css" DeviceDependant="true" />
      <Stylesheet Src="/sitecore/shell/Applications/Dialogs/SelectRendering/dialog.css" DeviceDependant="true" />
      <Script Src="/sitecore/shell/Applications/Dialogs/SelectRendering/dialog.js" />
      <CodeBeside Type="Client.Web.Custom.Dialogs.CustomSelectRenderingForm, Client.Web"/>


      <DataContext ID="DataContext" Root="/"/>

      <GridPanel Width="100%" Height="100%">

        <GridPanel Width="100%" Height="100%" Columns="3" GridPanel.Height="100%" Style="table-layout:fixed">

          <Scrollbox Width="100%" ID="TreeviewContainer" Height="100%" Class="scScrollbox scFixSize scFixSize4" style="border-right: 2px solid #474747;" Background="white" Padding="0px" GridPanel.Width="200px" GridPanel.Height="100%">
            <TreeviewEx ID="Treeview" DataContext="DataContext" ShowRoot="true" Click="Treeview_Click" />
          </Scrollbox>

          <VSplitter ID="TreeSplitter" GridPanel.Class="scThinSplitter" Target="left" />

          <Scrollbox ID="Renderings" Width="100%" Height="100%" Class="scScrollbox scFixSize scFixSize4" Background="white" Padding="0px" GridPanel.Height="100%">
          </Scrollbox>

          <Tabstrip ID="Tabs" Width="895px" Height="100%" Background="white" Padding="0px" style="position:absolute; width:100%;top:0px"/>

        </GridPanel>

        <Border ID="PlaceHolderNameBorder" Visible="false" style="padding:12px 0px 0px 0px">
          <GridPanel Columns="3" Width="100%">
            <Literal Text="Add to Placeholder: " GridPanel.NoWrap="true" />
            <Space Width="4" />
            <Edit ID="PlaceholderName" Name="PlaceholderName" GridPanel.Width="100%" class="scQuirksBoxModel" Width="100%" />
          </GridPanel>
        </Border>

      </GridPanel>

      <Border ID="OpenPropertiesBorder" def:placeholder="Buttons" Visible="false" style="padding:0px 0px 8px 0px">
        <Checkbox ID="OpenProperties" Header="Open the Properties dialog box immediately." />
      </Border>
    </FormDialog>
  </Sitecore.Shell.Applications.Dialogs.SelectRendering>
</control>

dialog.js

Here is dialog.js. It processes out of the iframe container and finds the surrounding div that we need to resize. Then we also resize the iframe itself. https://gist.github.com/dnstommy/448bd832c79cb28b77a26a3e28b35d50

document.addEventListener('DOMContentLoaded', function(){ 
    var parentDiv = parent.document.getElementsByClassName("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-draggable ui-resizable");

    if (parentDiv)
    {
        parentDiv[0].style.width = "1100px";
        parentDiv[0].style.height = "600px";
    }

    var iFrame = parent.document.getElementById("scContentIframeId0");
    if(iFrame)
        iFrame.style.height = "600px";

}, false);

Css

.scScrollbox.scFixSize4 { height: auto !important;}

Code Behind

Anyone coming across this that needs the code behind to make tabbed renderings, it can be found here. https://gist.github.com/dnstommy/c2ea97506b0c4d59f17c58358ffaa160

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.