private void AppendCol(HtmlElement colgroup, string columnWidth, bool hidden)
        {
            if (hidden) return;

            var col = new HtmlElement("col",TagRenderMode.SelfClosing);

            if (columnWidth.HasValue())
            {
                col.Css("width", columnWidth);
            }

            col.AppendTo(colgroup);
        }
        public IHtmlNode ContentTag()
        {
            var content = new HtmlElement("div")
                               .AddClass("t-window-content", UIPrimitives.Content)
                               .Css("overflow", Window.Scrollable ? "auto" : "hidden")
                               .Attributes(Window.ContentHtmlAttributes);

            if (Window.Width != 0)
            {
                content.Css("width", Window.Width + "px");
            }

            if (Window.Height != 0)
            {
                content.Css("height", Window.Height + "px");
            }

            if (Window.ContentUrl.HasValue() && RemoteUrlRegex.IsMatch(Window.ContentUrl))
            {
                new HtmlElement("iframe")
                    .Attributes(new {
                        src = Window.ContentUrl,
                        title = Window.Title,
                        style = "border: 0; width: 100%; height: 100%;",
                        frameborder = "0"
                    })
                    .Html("This page requires frames in order to show content")
                    .AppendTo(content);
            }
            else if (Window.Template.HasValue())
            {
                Window.Template.Apply(content);
            }

            return content;
        }
示例#3
0
        private void RenderTableHeader(IHtmlElement wrapper)
        {
            var container = new HtmlElement("div")
                .AddCssClass("lib-grid-header")
                .AppendTo(wrapper);

            if (!String.IsNullOrEmpty(context.Caption))
            {
//                new HtmlElement("caption").Text(context.Caption).AppendTo(table);
                new HtmlElement("caption").Text(context.Caption).AppendTo(container);
            }

            var c = new HtmlElement("div").AddCssClass("lib-grid-columns").AppendTo(container);

            if (context.Scrolling.Enabled)
            {
                c.Css("padding-right", Unit.Pixels(17).ToString());
            }

            var table = new HtmlElement("table")
                .Css("width", new Unit(100, UnitType.Percentage).ToString())
                .AppendTo(c);

            CreateColGroups(table);

            /*var groups = new HtmlElement("colgroup").AppendTo(table);

            foreach (var column in context.Columns.Where(column => column.Visible))
            {
                var group = new HtmlElement("col", TagRenderMode.SelfClosing);

                if (column.Widht != Unit.Empty)
                {
                    group.Css("width", column.Widht.ToString()).AppendTo(groups);
                }
            }*/

            var head = new HtmlElement("thead").AppendTo(table);

            headerRendererFactory
                .CreateRenderer(context)
                .RenderHeader()
                .AppendTo(head);
        }
示例#4
0
        private void RenderTableBody(IHtmlElement wrapper)
        {
            var container = new HtmlElement("div")
                .AddCssClass("lib-grid-content")
                .AppendTo(wrapper);

            if (context.Scrolling.Enabled)
            {
                container
                    .Css("height", context.Scrolling.Height.ToString())
                    .Css("overflow-y", "scroll");
            }

            var table = new HtmlElement("table")
                .Css("width", new Unit(100, UnitType.Percentage).ToString())
                .AppendTo(container);

            CreateColGroups(table);

            /*var groups = new HtmlElement("colgroup").AppendTo(table);

            foreach (var column in context.Columns.Where(column => column.Visible))
            {
                var group = new HtmlElement("col", TagRenderMode.SelfClosing);

                if (column.Widht != Unit.Empty)
                {
                    group.Css("width", column.Widht.ToString()).AppendTo(groups);
                }
            }*/

            var body = new HtmlElement("tbody").AppendTo(table);
            var enumerator = new GridDataSourceEnumerator(context.DataSource);
            var rowBuilders = enumerator.Select(row => rowRendererFactory.CreateRowRenderer(context, row));

            foreach(var builder in rowBuilders)
            {
                builder.CreateRow().AppendTo(body);
            }
        }
示例#5
0
        private void CreateColGroups(IHtmlElement table)
        {
            var groups = new HtmlElement("colgroup").AppendTo(table);

            foreach (var column in context.Columns.Where(column => column.Visible))
            {
                var group = new HtmlElement("col", TagRenderMode.SelfClosing).AppendTo(groups);

                if (!column.Widht.IsEmpty)
                {
                    group.Css("width", column.Widht.ToString());
                }
            }
        }