View wrap configuration doesn't work

2 posts, 0 answers
  1. Francesc
    Francesc avatar
    3 posts
    Member since:
    May 2013

    Posted 30 May 2013 Link to this post

    Setting the wrap configuration to false doesn't works.
    Wrapping by default with a div element braks the percent height feature of css.

    Here is the patch:

    (function($, undefined) {
        var kendo = window.kendo,
            Observable = kendo.Observable,
            SCRIPT = "SCRIPT",
            INIT = "init",
            SHOW = "show",
            HIDE = "hide";

        var View = Observable.extend({
            init: function(content, options) {
                var that = this;
                options = options || {};

                Observable.fn.init.call(that);
                that.content = content;
                that.tagName = options.tagName || "div";
                that.model = options.model;
                that.wrap = (options.wrap === undefined) ? true : false;

                that.bind([ INIT, SHOW, HIDE ], options);
            },

            render: function(container) {
                var that = this,
                    element,
                    content;

                if (!that.element) {
                    element = $("<" + that.tagName + " />");
                    content = $(document.getElementById(that.content) || that.content); // support passing id without #
                    element.append(content[0].tagName === SCRIPT ? content.html() : content);
                    that.element = (that.wrap === false) ? element.children() : element;
                    kendo.bind(that.element, that.model);
                    this.trigger(INIT);
                }

                if (container) {
                    this.trigger(SHOW);
                    $(container).append(that.element);
                }

                return that.element;
            },

            hide: function() {
                this.element.detach();
                this.trigger(HIDE);
            },

            destroy: function() {
                if (this.element) {
                    kendo.unbind(this.element);
                    this.element.remove();
                }
            }
        });

        var Layout = View.extend({
            init: function(content, options) {
                View.fn.init.call(this, content, options);
                this.regions = {};
            },

            showIn: function(container, view) {
                var previousView = this.regions[container];

                if (previousView) {
                    previousView.hide();
                }

                view.render(this.render().find(container), previousView);
                this.regions[container] = view;
            }
        });

        kendo.Layout = Layout;
        kendo.View = View;
    })(window.kendo.jQuery);

    Francesc Baeta
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 03 Jun 2013 Link to this post

    Hello Francesc,

    This sounds like a known issue which is fixed in the service pack release (2013.1.514).
    You can test it with the sample code from the corresponding API section.

    Regards,
    Alexander Valchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
Back to Top