Developer forum

Forum » CMS - Standard features » Paragraphs in Visual Editor columns disappear during editing of page

Paragraphs in Visual Editor columns disappear during editing of page

Jóhannes Þorkell Tómasson
Reply

Hello.

We have a custom DW solution where our customer is heavily relient on the Visual Editor feature. They have been experiencing paragraphs in Visual Editor columns disappearing during the editing of a page. I've tried to recreate the problem with fervor but to no avail. I have included a video which demonstrates the problem as it's hard too describe precisely. The paragraphs that are created are not destroyed but rather moved to the "(not int template)" section of the page overview "Content" tab. The solution is using DW version 9.14.2.

The row itemtype is custom where the customer can set the number of boxes (columns) to render. Here is the template:

@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.GridRowViewModel>

@{ 
    var smallBoxes = Model.Item.GetBoolean("Small_Boxes");
    int numberOfBoxes = string.IsNullOrWhiteSpace(Model.Item.GetString("Number_Of_Boxes")) ? 0 : Convert.ToInt32(Model.Item.GetString("Number_Of_Boxes"));
    int numberOfBoxesInt = numberOfBoxes;

    var rowsClass = "grid-rows--";
    int rowCount = numberOfBoxesInt / 2;
    rowsClass += rowCount <= 2 ? "2" : rowCount.ToString();
    var bannerSmallClass = smallBoxes ? "banner--small" : "";
}

    <div class="container container--banner row col-md-12">
        @if (numberOfBoxesInt == 1)
        {
            <div class="banner banner--regular grid grid-col--2 grid-rows--2 @bannerSmallClass">
                <div class="banner_box position-relative">
                    @Model.Column(1).Output()
                </div>
            </div>
        }
        else
        {
            <div class="banner banner--regular grid grid-col--2 @rowsClass @bannerSmallClass">
                @for (int i = 1; i <= numberOfBoxesInt; i++)
                {
                    var row = i / 2;
                    var col = i % 2;
                    if (i == numberOfBoxesInt && numberOfBoxesInt % 2 == 1)
                    {
                        <div class="banner_box box--large position-relative">
                            @Model.Column(i).Output()
                        </div>
                    }
                    else
                    {
                        <div class="banner_box row-@row col-@col position-relative">
                            @Model.Column(i).Output()
                        </div>
                    }
                    
                }
            </div>
        }
    </div>

 The entry in RowDefinitions.json for the template is:

  {
    "Id": "2-col-banner-boxes",
    "Name": "Banner Boxes",
    "ColumnCount": 10,
    "Template": "banner_boxes_row.cshtml",
    "ItemType": "WebShop_Grid_Banner_Box_Row",
    "Thumbnail": "/Files/Templates/Designs/Storcash/Grid/Grid/banner_boxes_row.png"
  }

Best regards,

Jóhannes


Replies

 
Arnór Halldórsson
Arnór Halldórsson
Reply

bump :)

 

You must be logged in to post in the forum