easyui js解析字符串_解析jQueryEasyUI的使用

jQueryEasyUI的使用方法其实非常简单。在第一次使用中,也还是碰到了些问题,特地做了一个简单的示例,然后复制过来文档。

页面代码:

jQuery EasyUI学习

$(function() {

$("#Tree").tree({

url: "/Home/GetJson",

onClick: function(node) {

alert(node.text);

}

})

})

后台代码: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 ListNode2 = new List() { node4 };

List ListNode3 = new List() { node5 };

Node node2 = new Node(2, "java分类", "closed", ListNode2);

Node node3 = new Node(3, "c#分类", "closed", ListNode3);

List ListNode1 = new List() { node2, node3 };

Node node1 = new Node(1, "图书分类", "closed", ListNode1);

List ListNode0 = new List() { node1 };

return Json(ListNode0, JsonRequestBehavior.AllowGet);

}

}

public class Node

{

public Node(int Id,string Text,string IconCls, List 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 children

{

get;

set;

}

}

显示效果如下:

上面的示例中没有方法的调用示例,jQueryEasyUI方法的调用很奇葩的说,如:alert($("#Tree").tree('getRoot').text);    //调用getRoot方法

$("#Tree").tree('collapseAll');         //调用collapseAll方法

参数:

事件

很多事件的回调函数需要 'node' 函数,它包含下列特性:

id:绑定到节点的标识值。

text:显示的文字。

checked:是否节点被选中。

attributes:绑定到节点的自定义属性。

target:目标的 DOM 对象。

方法

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值