This is a migrated thread and some comments may be shown as answers.

Possible bug with window using Visible(false)

8 Answers 759 Views
Window
This is a migrated thread and some comments may be shown as answers.
Brian Roth
Top achievements
Rank 1
Brian Roth asked on 04 Jun 2012, 03:02 PM
Hi,

We're starting to play with the MVC beta and liking what we're seeing so far.  But I think I may have found a bug with the window control.  If you default the visible state to false the window as well as the content get styled to display:none.  It seems like the display: none never gets removed from the content section when the window is activated.  All I see in the UI is the title bar of the window.  I ran into this in my application and was able to reproduce it on one of the demo pages.  In the actions.cshtml page I added .Visible(false) like so:

@(Html.Kendo().Window()
    .Name("window")
    .Title("About Josef Hoffmann")
    .Actions(actions => actions
        .Custom("custom")
        .Minimize()
        .Maximize()
        .Close()
    )
    .Content(@<text>
        <div class="armchair">
            <img src="@Url.Content("~/Content/web/window/kubus-armchair.png")"
                    alt="Josef Hoffmann - Kubus Armchair" />
            Josef Hoffmann - Kubus Armchair
        </div>
 
        <p>
            Josef Hoffmann studied architecture at the Academy of Fine Arts in Vienna,
            Austria, under Art Nouveau architect Otto Wagner, whose theories of functional,
            modern architecture profoundly influenced his works, and in 1896 he joined his office.
        </p>
 
        <p>
            In 1898, he established his own practice in Vienna. In 1897, inspired by Mackintosh
            and the Glasgow School, he was one of the founding members with Gustav Klimt, of an
            association of revolutionary artists and architects, the Vienna Secession.
        </p>
 
        <p>
            In 1903, he founded with architects Koloman Moser and Joseph Maria Olbrich, the Wiener
            Werkstätte for decorative arts.
        </p>
 
        <p>
            They aspired to the renaissance of the arts and crafts and to bring more abstract and
            purer forms to the designs of buildings and furniture, glass and metalwork, following
            the concept of total work of art. Hoffman's works combined functionality and simplicity
            of craft production with refined and innovative ornamental details and geometric
            elements. He is an important precursor of the Modern Movement and Art Deco.
        </p>
 
        <p>
            Source:
            <a href="http://www.senses-artnouveau.com/biography.php?artist=hof" title="About Josef Hoffmann">http://www.senses-artnouveau.com/<;/a>
        </p>
    </text>)
    .Draggable()
    .Resizable()
    .Visible(false)
    .Width(500)
)
 
<span id="undo" class="k-button">Click to open the window</span>
 
<script>
    $(document).ready(function() {
        var dialog = $("#window");
 
        $("#undo").bind("click", function() {
            dialog.data("kendoWindow").open();
        });
 
        dialog.data("kendoWindow").wrapper.find(".k-custom").click(function(e){
            alert("Custom action button clicked");
            e.preventDefault();
        });
    });
</script>
 
<style scoped>
    #example {
        min-height:500px;
    }
         
    .armchair {
        float: left;
        margin: 20px 30px;
        text-align: center;
    }
         
    .armchair img {
        display: block;
        margin-bottom: 10px;
    }
</style>

Let me know if there's something I'm doing wrong or if this indeed is an issue with the kendo code.  Thanks!

Regards,
Brian Roth

8 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 05 Jun 2012, 02:39 PM
Hello Brian,

Indeed, this is a problem with Kendo itself (initializing a window from a hidden <div>). We will address the issue for the next release. Your Telerik points have been updated for the bug report.

Kind regards,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Eric
Top achievements
Rank 1
answered on 08 Jun 2012, 03:42 AM
Alex, what is the proper workaround for now?  I've tried a few things like manually showing the content but it doesn't display.

Thanks
Eric
0
Eric
Top achievements
Rank 1
answered on 08 Jun 2012, 04:14 AM
OK, got something working.  I just surrounded the extension declaration with a hidden div and show/hide that instead.   The window itself is set to be visible in it's definition.
0
Brian Roth
Top achievements
Rank 1
answered on 05 Jul 2012, 09:13 PM
Hi Alex,

I tested this with the Beta release and it looks like it's fixed (mostly).  Thanks for that!  The one issue I'm still having is that for a window where I have a kendo DropDownList control on it, the DropDownList still does not show.  Any ideas of things I can try in order to fix this?

Thanks,
Brian
0
Don
Top achievements
Rank 1
answered on 05 Jul 2012, 11:57 PM
Just wanted to share a simple workaround that worked for me in case it helps anyone:

Originally, I had this in my code to show the window:

$('#myWin'
).data('kendoWindow').open().center().toFront();

As mentioned in this thread, the title would show but not the content.  Changing it to this made it work:

$('#myWin').show().data('kendoWindow').open().center().toFront();
0
Dan
Top achievements
Rank 1
answered on 28 Dec 2012, 08:39 PM
I'm using kendoui.aspnetmvc.2012.3.1114.commercial (and why doesn't the account show what version I bought?)

UPDATE: This issue was that my ContentPages contained additional jquery script includes. When I removed them, then it started working.

This is very frustrating. I still can't get this to work...

        @Html.Kendo().Window().Name("window").Title("Create Profile").Draggable().LoadContentFrom("Create", "Home").Visible(false)

        <a id='createProfile' href='#'>Add One</a>
        <script type="text/javascript">
            $("#createProfile").click(function () {
                $("#window").show().data("kendoWindow").open().center().toFront();
                alert('end');
            });

More information... It's failing on LoadContentFrom( ).

I've tried ActionResult and PartialViewResult with no luck. 

Any ideas?

 
public ActionResult Create()
      {
          return View();
      }
0
kurt place
Top achievements
Rank 2
answered on 22 Apr 2015, 11:22 PM
It seems that I am seeing this as well.  I have a kendo window in an ascx file.  There are 2 on the page, one that starts visible and the other not until later it is shown programmatically.  When the window from the first control is shown then the content is visible.  However when I have the window from the second control the content's div is marked as visibility: hidden; and does not show.
0
Dimo
Telerik team
answered on 27 Apr 2015, 12:33 PM
Hello Kurt,

If there is a <div> with a visibility:hidden style inside the Window content, then you need to remove this style yourself, e.g. in the show event. The Window does not manage the styling of its content in any way.

Generally, this visibility style is not needed at all, because a Window widget with a .Visible(false) setting will be rendered with a display:none style, so none of its descendant elements will be visible. The display:none style will be removed by the widget automatically upon opening.

Regards,
Dimo
Telerik

See What's Next in App Development. Register for TelerikNEXT.

Tags
Window
Asked by
Brian Roth
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Eric
Top achievements
Rank 1
Brian Roth
Top achievements
Rank 1
Don
Top achievements
Rank 1
Dan
Top achievements
Rank 1
kurt place
Top achievements
Rank 2
Dimo
Telerik team
Share this question
or