解析jQueryEasyUI的使用
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了解析jQueryEasyUI的使用,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2066字,纯文字阅读大概需要3分钟。
内容图文
![解析jQueryEasyUI的使用](/upload/InfoBanner/zyjiaocheng/305/dc5138a178644321ae43b46f75429d76.jpg)
页面代码:
<html> <head> <title>jQuery EasyUI学习</title> <script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script src="../../Scripts/jquery.easyui.min.js" type="text/javascript"></script> <link href="../../themes/default/easyui.css" rel="stylesheet" type="text/css" /> <link href="../../themes/icon.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $(function() { $("#Tree").tree({ url: "/Home/GetJson", onClick: function(node) { alert(node.text); } }) }) </script> </head> <body> <ul id="Tree"> </ul> </body> </html>
后台代码:
public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult About() { return View(); } public ActionResult GetJson() { Node node4 = new Node(4, "java从入门到精通", "open", null); Node node5 = new Node(5, "30天精通C#", "open", null); List<Node> ListNode2 = new List<Node>() { node4 }; List<Node> ListNode3 = new List<Node>() { node5 }; Node node2 = new Node(2, "java分类", "closed", ListNode2); Node node3 = new Node(3, "c#分类", "closed", ListNode3); List<Node> ListNode1 = new List<Node>() { node2, node3 }; Node node1 = new Node(1, "图书分类", "closed", ListNode1); List<Node> ListNode0 = new List<Node>() { node1 }; return Json(ListNode0, JsonRequestBehavior.AllowGet); } } public class Node { public Node(int Id,string Text,string IconCls, List<Node> Children) { id = Id; text = Text; iconCls = IconCls; children = Children; } public int id { get; set; } public string text { get; set; } public string iconCls { get; set; } public List<Node> children { get; set; } }
显示效果如下:
上面的示例中没有方法的调用示例,jQueryEasyUI方法的调用很奇葩的说,如:
alert($("#Tree").tree('getRoot').text); //调用getRoot方法 $("#Tree").tree('collapseAll'); //调用collapseAll方法
参数:
事件
很多事件的回调函数需要 'node' 函数,它包含下列特性:
id:绑定到节点的标识值。
text:显示的文字。
checked:是否节点被选中。
attributes:绑定到节点的自定义属性。
target:目标的 DOM 对象。
方法
内容总结
以上是互联网集市为您收集整理的解析jQueryEasyUI的使用全部内容,希望文章能够帮你解决解析jQueryEasyUI的使用所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。