官方提供的treegrid的ex 我给大家贴出来看看吧:
复制代码 代码如下:
$(function(){
$('#tt').treegrid({
url:'treegrid_data3.json',
onAfterEdit:function(row,changes){
alert(row.name);
}
});
})
这个是页面初始化的。
看看他的JSON:
复制代码 代码如下:
{"total":117,"rows":[
<SPAN style="COLOR: #ff0000">{"id":1,"code":"code1","name":"name1","addr":"address1","state":"closed"},</SPAN>
{"id":11,"code":"code11","name":"name11","addr":"address11","<SPAN style="COLOR: #ff0000">_parentId":1</SPAN>},
{"id":12,"code":"code12","name":"name12","addr":"address12","<SPAN style="COLOR: #ff0000">_parentId":1</SPAN>},
{"id":21,"code":"code21","name":"name21","addr":"address21","_parentId":1},
{"id":22,"code":"code22","name":"name22","addr":"address22","_parentId":1},
{"id":31,"code":"code31","name":"name31","addr":"address31","_parentId":1},
{"id":32,"code":"code32","name":"name32","addr":"address32","_parentId":1},
{"id":41,"code":"code41","name":"name41","addr":"address41","_parentId":1},
{"id":42,"code":"code42","name":"name42","addr":"address42","_parentId":1},
{"id":51,"code":"code51","name":"name51","addr":"address51","_parentId":1},
{"id":52,"code":"code52","name":"name52","addr":"address52","_parentId":1},
{"id":61,"code":"code61","name":"name61","addr":"address61","_parentId":1},
{"id":62,"code":"code62","name":"name62","addr":"address62","_parentId":1},
{"id":71,"code":"code71","name":"name71","addr":"address71","_parentId":1},
{"id":72,"code":"code72","name":"name72","addr":"address72","_parentId":1},
{"id":81,"code":"code81","name":"name81","addr":"address81","_parentId":1},
{"id":82,"code":"code82","name":"name82","addr":"address82","_parentId":1},
{"id":91,"code":"code91","name":"name91","addr":"address91","_parentId":1},
{"id":92,"code":"code92","name":"name92","addr":"address92","_parentId":1},
{"id":110,"code":"code110","name":"name110","addr":"address110","_parentId":1},
{"id":120,"code":"code120","name":"name120","addr":"address120","_parentId":1}
]}
标红的地方是特别有用的,我按照他的这个做法,自己做了一个,始终是没有数据的,后来发现了一个问题,
复制代码 代码如下:
{"total":29,"rows":[
{"Id":25,"Ids":25,"name":"直辖市","state":"closed",<SPAN style="COLOR: #ff0000">"_parentId":2</SPAN>,"orderId":2},
{"Id":44,"Ids":44,"name":"黑龙江","state":"closed","_parentId":2,"orderId":110},
{"Id":45,"Ids":45,"name":"吉林","state":"closed","_parentId":2,"orderId":1},
{"Id":46,"Ids":46,"name":"辽宁","state":"closed","_parentId":2,"orderId":3},
{"Id":47,"Ids":47,"name":"河北","state":"closed","_parentId":2,"orderId":4},
{"Id":48,"Ids":48,"name":"内蒙古","state":"closed","_parentId":2,"orderId":111},
{"Id":49,"Ids":49,"name":"山西","state":"closed","_parentId":2,"orderId":6},
{"Id":50,"Ids":50,"name":"江西","state":"closed","_parentId":2,"orderId":11},
{"Id":51,"Ids":51,"name":"山东","state":"closed","_parentId":2,"orderId":12},
{"Id":52,"Ids":52,"name":"台湾","state":"closed","_parentId":2,"orderId":13},
{"Id":53,"Ids":53,"name":"甘肃","state":"closed","_parentId":2,"orderId":15},
{"Id":54,"Ids":54,"name":"宁夏","state":"closed","_parentId":2,"orderId":16},
{"Id":55,"Ids":55,"name":"青海","state":"closed","_parentId":2,"orderId":17},
{"Id":56,"Ids":56,"name":"新疆","state":"closed","_parentId":2,"orderId":18},
{"Id":57,"Ids":57,"name":"云南","state":"closed","_parentId":2,"orderId":19}]}
上面这个数据 没有一个根节点,所以页面出来什么都没有。。。。。我的数据只有parentId这个玩意,所以页面一片空白。
这个问题修正了,但是又出现新的问题了。开始我的处理方式是直接把所有数据load进来,点击节点展开是没有问题的。但是所有数据一起装载,不光耗性能不说,还特别慢。
所以想到异步加载。又到官方上去看了半天,官方提供了一大堆事件,什么展开触发哦之类的,没有一个说到点上的。
我用火狐监听每次数据都加载了的,而且有返回正确的JSON
复制代码 代码如下:
{"total":29,"rows":[
{"Id":25,"Ids":25,"name":"直辖市","state":"closed",<SPAN style="COLOR: #ff0000">"_parentId":2</SPAN>,"orderId":2},
{"Id":44,"Ids":44,"name":"黑龙江","state":"closed","_parentId":2,"orderId":110},
。。。。<BR>经过我反复的对比tree和这个treegrid。最后发现treegrid 在请求过来的数据上有个total和rows ,而tree没有。
难道是这个total和rows在作怪,我赶紧把这个删掉了,果然数据出来了
大家可以百度一下,各种说法都有。
最后一个小结: easyui treegrid使用时需注意:
1、必须要有根节点;
2、父节点装载的数据格式和子节点装载的数据格式 是不一样的。
父节点需要total和rows 而子节点装载的时候和tree的数据格式相同。 目前只弄了个两级的,多级的还没有去试。留篇文章,以备后用。
也热烈欢迎大家指正。
复制代码 代码如下:
$(function(){
$('#tt').treegrid({
url:'treegrid_data3.json',
onAfterEdit:function(row,changes){
alert(row.name);
}
});
})
这个是页面初始化的。
看看他的JSON:
复制代码 代码如下:
{"total":117,"rows":[
<SPAN style="COLOR: #ff0000">{"id":1,"code":"code1","name":"name1","addr":"address1","state":"closed"},</SPAN>
{"id":11,"code":"code11","name":"name11","addr":"address11","<SPAN style="COLOR: #ff0000">_parentId":1</SPAN>},
{"id":12,"code":"code12","name":"name12","addr":"address12","<SPAN style="COLOR: #ff0000">_parentId":1</SPAN>},
{"id":21,"code":"code21","name":"name21","addr":"address21","_parentId":1},
{"id":22,"code":"code22","name":"name22","addr":"address22","_parentId":1},
{"id":31,"code":"code31","name":"name31","addr":"address31","_parentId":1},
{"id":32,"code":"code32","name":"name32","addr":"address32","_parentId":1},
{"id":41,"code":"code41","name":"name41","addr":"address41","_parentId":1},
{"id":42,"code":"code42","name":"name42","addr":"address42","_parentId":1},
{"id":51,"code":"code51","name":"name51","addr":"address51","_parentId":1},
{"id":52,"code":"code52","name":"name52","addr":"address52","_parentId":1},
{"id":61,"code":"code61","name":"name61","addr":"address61","_parentId":1},
{"id":62,"code":"code62","name":"name62","addr":"address62","_parentId":1},
{"id":71,"code":"code71","name":"name71","addr":"address71","_parentId":1},
{"id":72,"code":"code72","name":"name72","addr":"address72","_parentId":1},
{"id":81,"code":"code81","name":"name81","addr":"address81","_parentId":1},
{"id":82,"code":"code82","name":"name82","addr":"address82","_parentId":1},
{"id":91,"code":"code91","name":"name91","addr":"address91","_parentId":1},
{"id":92,"code":"code92","name":"name92","addr":"address92","_parentId":1},
{"id":110,"code":"code110","name":"name110","addr":"address110","_parentId":1},
{"id":120,"code":"code120","name":"name120","addr":"address120","_parentId":1}
]}
标红的地方是特别有用的,我按照他的这个做法,自己做了一个,始终是没有数据的,后来发现了一个问题,
复制代码 代码如下:
{"total":29,"rows":[
{"Id":25,"Ids":25,"name":"直辖市","state":"closed",<SPAN style="COLOR: #ff0000">"_parentId":2</SPAN>,"orderId":2},
{"Id":44,"Ids":44,"name":"黑龙江","state":"closed","_parentId":2,"orderId":110},
{"Id":45,"Ids":45,"name":"吉林","state":"closed","_parentId":2,"orderId":1},
{"Id":46,"Ids":46,"name":"辽宁","state":"closed","_parentId":2,"orderId":3},
{"Id":47,"Ids":47,"name":"河北","state":"closed","_parentId":2,"orderId":4},
{"Id":48,"Ids":48,"name":"内蒙古","state":"closed","_parentId":2,"orderId":111},
{"Id":49,"Ids":49,"name":"山西","state":"closed","_parentId":2,"orderId":6},
{"Id":50,"Ids":50,"name":"江西","state":"closed","_parentId":2,"orderId":11},
{"Id":51,"Ids":51,"name":"山东","state":"closed","_parentId":2,"orderId":12},
{"Id":52,"Ids":52,"name":"台湾","state":"closed","_parentId":2,"orderId":13},
{"Id":53,"Ids":53,"name":"甘肃","state":"closed","_parentId":2,"orderId":15},
{"Id":54,"Ids":54,"name":"宁夏","state":"closed","_parentId":2,"orderId":16},
{"Id":55,"Ids":55,"name":"青海","state":"closed","_parentId":2,"orderId":17},
{"Id":56,"Ids":56,"name":"新疆","state":"closed","_parentId":2,"orderId":18},
{"Id":57,"Ids":57,"name":"云南","state":"closed","_parentId":2,"orderId":19}]}
上面这个数据 没有一个根节点,所以页面出来什么都没有。。。。。我的数据只有parentId这个玩意,所以页面一片空白。
这个问题修正了,但是又出现新的问题了。开始我的处理方式是直接把所有数据load进来,点击节点展开是没有问题的。但是所有数据一起装载,不光耗性能不说,还特别慢。
所以想到异步加载。又到官方上去看了半天,官方提供了一大堆事件,什么展开触发哦之类的,没有一个说到点上的。
我用火狐监听每次数据都加载了的,而且有返回正确的JSON
复制代码 代码如下:
{"total":29,"rows":[
{"Id":25,"Ids":25,"name":"直辖市","state":"closed",<SPAN style="COLOR: #ff0000">"_parentId":2</SPAN>,"orderId":2},
{"Id":44,"Ids":44,"name":"黑龙江","state":"closed","_parentId":2,"orderId":110},
。。。。<BR>经过我反复的对比tree和这个treegrid。最后发现treegrid 在请求过来的数据上有个total和rows ,而tree没有。
难道是这个total和rows在作怪,我赶紧把这个删掉了,果然数据出来了
大家可以百度一下,各种说法都有。
最后一个小结: easyui treegrid使用时需注意:
1、必须要有根节点;
2、父节点装载的数据格式和子节点装载的数据格式 是不一样的。
父节点需要total和rows 而子节点装载的时候和tree的数据格式相同。 目前只弄了个两级的,多级的还没有去试。留篇文章,以备后用。
也热烈欢迎大家指正。
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月30日
2024年11月30日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]