日期:2014-05-16  浏览次数:22742 次

jqgrid treeGrid Json数据 怎么默认全部展开啊
代码如 http://archive.cnblogs.com/a/1966520/
我要的效果就是页面数据加载完毕时列表就自动展开, 但是没弄出来

官方的json解释也是
JScript code
{id: "1", name: "Cash",        num: "100", debit: "400.00",  credit: "250.00",  balance: "150.00",   enbl: "1", level: "0", parent: "null", isLeaf: false, expanded: false, loaded: true}

 但是我把 expanded的值都给了true 还是不凑效
哪位大神帮帮研究下啊

------解决方案--------------------
rows对象中cell代表含义-列中的单元格:
cell:{“data 1”:””,”data 2”:””,”data …”:””,”data n”:””,
”level”:”0”,”parent”:”parentId”,”isLeaf”:”false”,”expanded”:”false”,”loaded”:”true”}
Level:表示层级数,从0开始;
Parent:表示父级ID;
isLeaf:是否是叶子节点;
Expanded:是否展开;
Loaded:是否异步加载

对于展开,不仅仅取决于你是否正确设置了Expanded属性,还取决于你parent所设置的值是否正确。
举例说明:
"rows": [
{"id": "1", "cell": ["1", "首页", "0", "", "false", "true","true"]},

{"id": "2", "cell": ["2", "Grid", "1", "1", "false","false","true"]}, 
{"id": "3", "cell": ["3", "Grid 1", "2", "2", "true","true","true"]},
{"id": "4", "cell": ["4", "Grid 2", "2", "2", "true","true","true"]}]
注意Grid 1和Grid 2后面的对应parent中的那个“2”,取的就是其父节点Grid的id值:2。