예제 #1
0
        /// <summary>
        ///
        /// </summary>
        public TreeSelectionModel.Builder TreeSelectionModel(TreeSelectionModel component)
        {
#if MVC
            component.ViewContext = this.HtmlHelper != null ? this.HtmlHelper.ViewContext : null;
#endif
            return(new TreeSelectionModel.Builder(component));
        }
예제 #2
0
        protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            bool   result = base.LoadPostData(postDataKey, postCollection);
            string val    = postCollection[this.SelectedHiddenName ?? this.ConfigID.ConcatWith("_SM")];

            if (val != null)
            {
                if (this.SelectionModel.Primary == null)
                {
                    this.SelectionModel.Add(new TreeSelectionModel {
                        EnableViewState = false
                    });
                }

                List <SubmittedNode> nodes = JSON.Deserialize <List <SubmittedNode> >(val, new CamelCasePropertyNamesContractResolver());

                if (nodes != null)
                {
                    nodes.Each(n => { n.Tree = this; });
                }

                TreeSelectionModel selModel = (TreeSelectionModel)this.SelectionModel.Primary;

                selModel.SelectedNodes = nodes;
                this.SelectedNodes     = nodes;
                selModel.SelectedRows.Clear();

                if (selModel.SelectedNodes != null && selModel.SelectedNodes.Count > 0)
                {
                    selModel.SelectedRows.AddRange(selModel.SelectedNodes.ConvertAll <SelectedRow>(n => new SelectedRow(n.NodeID)));
                }
            }

            val = postCollection[this.CheckedHiddenName ?? this.ConfigID.ConcatWith("_CheckNodes")];
            if (val != null)
            {
                List <SubmittedNode> nodes = JSON.Deserialize <List <SubmittedNode> >(val, new CamelCasePropertyNamesContractResolver());
                if (nodes != null)
                {
                    nodes.Each(n => { n.Tree = this; });
                }
                this.CheckedNodes = nodes;
            }

            return(result);
        }
 /// <summary>
 ///
 /// </summary>
 public TreeSelectionModel.Builder TreeSelectionModel(TreeSelectionModel component)
 {
     return(new TreeSelectionModel.Builder(component));
 }