Beispiel #1
0
        public MvcHtmlString JQTreeView(JQTreeView tree, string id)
        {
            JQTreeViewRenderer jQTreeViewRenderer = new JQTreeViewRenderer(tree);

            tree.ID = id;
            return(MvcHtmlString.Create(jQTreeViewRenderer.RenderHtml()));
        }
Beispiel #2
0
        private string GetStartupOptions()
        {
            StringBuilder            stringBuilder    = new StringBuilder();
            JQTreeView               model            = this._model;
            TreeViewClientSideEvents clientSideEvents = model.ClientSideEvents;

            stringBuilder.AppendFormat("id: '{0}'", model.ID);
            stringBuilder.AppendFormat(",dataUrl: '{0}'", model.DataUrl);
            if (!model.HoverOnMouseOver)
            {
                stringBuilder.AppendFormat(",hoverOnMouseOver:false", new object[0]);
            }
            if (model.CheckBoxes)
            {
                stringBuilder.Append(",checkBoxes:true");
            }
            if (model.MultipleSelect)
            {
                stringBuilder.Append(",multipleSelect:true");
            }
            if (!string.IsNullOrEmpty(clientSideEvents.Check))
            {
                stringBuilder.AppendFormat(",onCheck:{0}", clientSideEvents.Check);
            }
            if (!string.IsNullOrEmpty(clientSideEvents.Collapse))
            {
                stringBuilder.AppendFormat(",onCollapse:{0}", clientSideEvents.Collapse);
            }
            if (!string.IsNullOrEmpty(clientSideEvents.Expand))
            {
                stringBuilder.AppendFormat(",onExpand:{0}", clientSideEvents.Expand);
            }
            if (!string.IsNullOrEmpty(clientSideEvents.MouseOut))
            {
                stringBuilder.AppendFormat(",onMouseOut:{0}", clientSideEvents.MouseOut);
            }
            if (!string.IsNullOrEmpty(clientSideEvents.MouseOver))
            {
                stringBuilder.AppendFormat(",onMouseOver:{0}", clientSideEvents.MouseOver);
            }
            if (!string.IsNullOrEmpty(clientSideEvents.Select))
            {
                stringBuilder.AppendFormat(",onSelect:{0}", clientSideEvents.Select);
            }
            return(stringBuilder.ToString());
        }
 public JQTreeViewRenderer(JQTreeView model)
 {
     this._model = model;
 }
        public void SetCheckedNodes(List<JQTreeNode> allNodes)
        {
            var checkedNodes = Session["checkedNodes"] as List<JQTreeNode>;
            if (checkedNodes != null)
            {
                var tree = new JQTreeView();
                var allNodesFlat = tree.GetAllNodesFlat(allNodes);

                foreach (JQTreeNode node in allNodesFlat)
                {
                    var matchedCheckedNode =
                        checkedNodes.Find(checkedNode => checkedNode.Value == node.Value);
                    if (matchedCheckedNode != null)
                        node.Checked = true;
                }
            }
        }
        public JsonResult TreeView_CheckBoxes_DataRequested()
        {
            var tree = new JQTreeView();

            //var userId = User.Identity.GetUserId();
            var module = _unitOfWork.ModulesRepository.DbSet.Where(m => m.ParentModuleId == null).ToList();
            //from mod in _unitOfWork.ModulesRepository.DbSet
            //join modAccess in _unitOfWork.ModuleUserAccessRepository.DbSet on mod.ModuleId equals modAccess.ModuleId
            //where modAccess.UserId == userId
            //select mod;
            //var module = mod.ToList();
            var nodes = new List<JQTreeNode>();
            foreach (var mod in module)
            {
                nodes.Add(new JQTreeNode
                {
                    Text = mod.ModuleName,
                    Value = mod.ModuleId.ToString(CultureInfo.InvariantCulture),
                    Expanded = true
                });

                foreach (var subMod in mod.SubModules)
                {
                    var secondNode = nodes.Find(n => n.Text == mod.ModuleName);
                    secondNode.Nodes.Add(new JQTreeNode { Text = subMod.ModuleName, Value = subMod.ModuleId.ToString(CultureInfo.InvariantCulture) });
                }
            }

            SetCheckedNodes(nodes);

            return tree.DataBind(nodes);
        }
Beispiel #6
0
 public JQTreeViewRenderer(JQTreeView model)
 {
     this._model = model;
 }