Exemplo n.º 1
0
        /// <summary>
        /// 设置子元素
        /// </summary>
        protected override void SetChildElements()
        {
            TreeGrid control = this.ControlHost.Content as TreeGrid;

            this.HtmlWriter.AddAttribute("dojoType", "Controls/Dgrid/TreeGrid");
            if (!IsPreview && !string.IsNullOrEmpty(this.ControlHost.Name))
            {
                this.HtmlWriter.AddAttribute("id", this.ControlHost.Name);
                this.HtmlWriter.AddAttribute("name", this.ControlHost.Name);
            }

            StringBuilder sbProps       = new StringBuilder();
            StringBuilder returnContent = new StringBuilder();
            string        props         = control.BuildControlProps(this.ScreenDefinition, this.IsPreview, this.PermissionData, returnContent);

            if (!string.IsNullOrEmpty(props))
            {
                sbProps.AppendFormat("{0},", props);
            }
            if (control.AutoLoadData)
            {
                sbProps.AppendFormat("{0},", "autoLoadData:false");
            }
            sbProps.AppendFormat("{0},", "hiddenColoumnButton:" + control.HiddenColoumnButton.ToString().ToLower() + "");

            bool remberConfig = false;

            if (!string.IsNullOrEmpty(this.ControlHost.Name))
            {
                remberConfig = true;
            }
            sbProps.AppendFormat("{0},", "remberConfig:" + remberConfig.ToString().ToLower());
            sbProps.AppendFormat("{0},", "pagingTextBox:true");
            sbProps.AppendFormat("{0},", "allowTextSelection:true");
            sbProps.AppendFormat("{0},", "allowSelectAll:true");
            sbProps.AppendFormat("{0},", "firstLastArrows:true");
            sbProps.AppendFormat("{0},", "collection:null");
            sbProps.AppendFormat("{0},", "expanded:" + control.Expanded.ToString().ToLower() + "");

            string structures = GetTreeGridStructure();

            if (!string.IsNullOrEmpty(structures))
            {
                sbProps.AppendFormat("{0},", structures);
            }
            if (sbProps.ToString().Length > 0)
            {
                this.HtmlWriter.AddAttribute("data-dojo-props", sbProps.ToString().Substring(0, sbProps.ToString().Length - 1), false);
            }
            this.HtmlWriter.RenderBeginTag(this.TagName);

            foreach (var child in this.ControlHost.Children)
            {
            }

            this.HtmlWriter.RenderEndTag();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 设置属性
        /// </summary>
        protected override void SetAttributes()
        {
            TreeGrid control = this.ControlHost.Content as TreeGrid;

            this.HtmlWriter.AddAttribute("dojoType", "Controls/Panel");
            string stores = GetStore();

            StringBuilder returnContent = new StringBuilder();
            string        props         = control.BuildControlProps(this.ScreenDefinition, this.IsPreview, this.PermissionData, returnContent);
            string        dojoProps     = stores + returnContent;

            if (!string.IsNullOrEmpty(dojoProps))
            {
                this.HtmlWriter.AddAttribute("data-dojo-props", dojoProps.ToString().Length == 0 ? "" : dojoProps.ToString().Substring(0, dojoProps.ToString().Length - 1), false);
            }

            base.SetAttributes();
        }