示例#1
0
        public void RenderSchema(StringBuilder script)
        {
            string comma = string.Empty;

            foreach (DataControlField df in this.Columns)
            {
                if (!df.Visible)
                {
                    continue;
                }
                if (!(df is YuiTemplateField))
                {
                    continue;
                }

                YuiTemplateField tf = df as YuiTemplateField;

                script.Append(comma);
                script.Append("{");
                script.Append("key:\"" + tf.Key + "\"");

                if (tf.Parser.Length > 0)
                {
                    script.Append(",parser:\"" + tf.Parser + "\"");
                }

                script.Append("}");

                comma = ",";
            }
        }
示例#2
0
        public void RenderColumnDefs(StringBuilder script)
        {
            string comma = string.Empty;

            foreach (DataControlField df in this.Columns)
            {
                if (!df.Visible)
                {
                    continue;
                }
                if (!(df is YuiTemplateField))
                {
                    continue;
                }

                YuiTemplateField tf = df as YuiTemplateField;
                script.Append(comma);
                script.Append("{");
                script.Append("key:\"" + tf.Key + "\"");
                if (tf.HeaderText.Length > 0)
                {
                    script.Append(",label:\"" + tf.HeaderText + "\"");
                }

                if (tf.Abbr.Length > 0)
                {
                    script.Append(",abbr:\"" + tf.Abbr + "\"");
                }

                if (tf.Formatter.Length > 0)
                {
                    script.Append(",formatter:\"" + tf.Formatter + "\"");
                }

                if (tf.Sortable)
                {
                    script.Append(",sortable: true");
                }
                else
                {
                    script.Append(",sortable: false");
                }

                if (tf.Hidden)
                {
                    script.Append(",hidden: true");
                }
                else
                {
                    script.Append(",'hidden': false");
                }

                if (tf.Resizable)
                {
                    script.Append(",resizable: true");
                }
                else
                {
                    script.Append(",resizable: false");
                }

                script.Append(",width:" + tf.ColumnWidth.ToString(CultureInfo.InvariantCulture));
                script.Append(",maxautowidth:" + tf.MaxAutoWidth.ToString(CultureInfo.InvariantCulture));
                script.Append(",minwidth:" + tf.MinWidth.ToString(CultureInfo.InvariantCulture));

                script.Append("}");
                comma = ",";
            }
        }