예제 #1
0
        public EditorElementItem(string tableName, string columnName, Type columnType)
        {
            name  = columnName;
            label = TableKeys.GetColumnComment(tableName, columnName);
            var  fkKey = TableKeys.GetColumnRelation(tableName, columnName);
            bool isFk  = !string.IsNullOrEmpty(fkKey.columnName);

            view = getColumnEditType(columnType, isFk);
            if (isFk)
            {
                options = IdValueItem.getAll(NameDict.city, NameDict.name);
            }
            else
            {
                var maxLength = TableKeys.GetColumnMaxLength(tableName, columnName);
                if (maxLength > 0)
                {
                    attributes = new AttributesItem(maxLength);
                    pattern    = PatternItem.getByType(columnType, maxLength);
                }
            }
            if (columnType == typeof(DateTime))
            {
                timepicker = true;
            }
        }