示例#1
0
        public SplitButtonModel(SplitButtonItem defaultItem, SplitButtonItem dropDownButton, params SplitButtonItem[] items)
            : this()
        {
            this.DefaultButton  = defaultItem;
            this.DropDownButton = dropDownButton;

            if (!items.IsNullOrEmpty())
            {
                if (this.DropDownButton == null)
                {
                    this.DropDownButton = new SplitButtonItem(null, " ", null, "{ \"text\": false, \"icons\": { \"primary\": \"ui-icon-triangle-1-s\" } }");
                }

                this.Items = new List <SplitButtonItem>(items);
            }
        }
        private SplitButtonItem CopySplitButtonItem(SplitButtonItem original, IDictionary <TableModel.PropertyInfo, object> item)
        {
            if (original != null)
            {
                string href = original.Href;

                if (href.IsNullOrEmpty())
                {
                    return(original);
                }

                //Update the URL, filling in any values from this item. Replace {ColumnName} or the encoded version %7BColumnName%7D.
                foreach (string columnName in this.ColumnNames.Union(new[] { this.IDPropertyName }))
                {
                    href = Regex.Replace(href, "({{{0}}}|%7B{0}%7D)".FormatString(columnName), Convert.ToString(GetItemValue(item, columnName).Value));
                }

                return(new SplitButtonItem(href, original.Text, original.Class, original.Options));
            }

            return(null);
        }
示例#3
0
 public SplitButtonModel(SplitButtonItem defaultItem, params SplitButtonItem[] items)
     : this(defaultItem, null, items)
 {
 }