Esempio n. 1
0
        /// <summary>
        /// 设置快速搜索栏
        /// </summary>
        /// <param name="source">输出组件</param>
        /// <param name="location">位置</param>
        /// <param name="key">参数键</param>
        /// <param name="placeholder">占位符</param>
        public static void SetQuickSearch(this IHtmlOutput source, ILocation location, string key = "key", string placeholder = null)
        {
            var script = string.Format(
                "oldmansoft.webman.search.on({{ action: '{0}', target: '{1}', name: '{2}', placeholder: '{3}' }})",
                location.Path.JavaScriptEncode(),
                location.Behave.GetTarget(),
                key.JavaScriptEncode(),
                string.IsNullOrEmpty(placeholder) ? location.Display.JavaScriptEncode() : placeholder.JavaScriptEncode()
                );

            source.AddEvent(AppEvent.Active, script);
        }
Esempio n. 2
0
        /// <summary>
        /// 格式化
        /// </summary>
        /// <param name="outer"></param>
        protected override void Format(IHtmlOutput outer)
        {
            var name = outer.Generator.GetGeneratorName();

            AddClass(name);
            if (ViewMode)
            {
                AddClass("view-mode");
            }

            AddButtonGroup();
            base.Format(outer);
            if (ViewMode)
            {
                outer.AddEvent(AppEvent.Load, Script.ToString());
            }
            else
            {
                outer.AddEvent(AppEvent.Load, string.Format("oldmansoft.webman.setFormValidate(view, '{0}', {1});{2}", name, Validator.Create(), Script.ToString()));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 格式化
        /// </summary>
        /// <param name="outer"></param>
        protected override void Format(IHtmlOutput outer)
        {
            var name = outer.Generator.GetGeneratorName();

            SetTableAction(outer, name);

            foreach (var item in FrontNodes)
            {
                item.Format(outer);
            }

            var table = new HtmlElement(HtmlTag.Table);

            table.AddClass(name);
            table.AddClass("dataTable");
            table.AddClass("hover");
            table.Data("parameter", GetSelectedParameterName());

            var header = new HtmlElement(HtmlTag.THead);

            table.Append(header);
            var tbody = new HtmlElement(HtmlTag.TBody);
            var count = SetBody(tbody);

            table.Append(tbody);
            var footer = new HtmlElement(HtmlTag.TFoot);

            table.Append(footer);

            header.Append(CreateDefinitionColumns());
            footer.Append(CreateDefinitionColumns());

            base.Append(table);
            if (IsDisplayTableInfo)
            {
                base.Append(GetBodyTableInfo(count));
            }
            base.Format(outer);

            foreach (var item in AfterNodes)
            {
                item.Format(outer);
            }

            outer.AddEvent(AppEvent.Load,
                           string.Format(
                               "oldmansoft.webman.setStaticTable(view, '{0}', {1});",
                               name,
                               GetOptionScript()
                               )
                           );
        }
Esempio n. 4
0
        /// <summary>
        /// 格式化
        /// </summary>
        /// <param name="outer"></param>
        protected override void Format(IHtmlOutput outer)
        {
            var name = outer.Generator.GetGeneratorName();

            SetTableAction(outer, name);

            foreach (var item in FrontNodes)
            {
                item.Format(outer);
            }

            AddClass(name);
            AddClass("dataTable");
            AddClass("hover");
            Data("parameter", GetSelectedParameterName());

            var header = new HtmlElement(HtmlTag.THead);

            base.Append(header);
            base.Append(new HtmlElement(HtmlTag.TBody));
            var footer = new HtmlElement(HtmlTag.TFoot);

            base.Append(footer);

            header.Append(CreateDefinitionColumns());
            footer.Append(CreateDefinitionColumns());
            base.Format(outer);

            foreach (var item in AfterNodes)
            {
                item.Format(outer);
            }
            outer.AddEvent(AppEvent.Load,
                           string.Format(
                               "oldmansoft.webman.setDataTable(view, '{0}', '{1}', {2});",
                               name,
                               DataSourceLoation,
                               GetOptionScript()
                               )
                           );
        }