jQuery MiniUI
标题:
还是一个关于TreeGrid的问题
[打印本页]
作者:
deartszy
时间:
2012-9-14 17:39:24
标题:
还是一个关于TreeGrid的问题
在加载TreeGrid时,如果通过setData的方式来设置数据(代码如下),则显示出来的TreeGrid没有级次关系(如下图)。而如果通过在Grid中设置Url的方式,或者直接设置文件的方式来加载数据则能够显示出级次关系。版主帮我看看呗!
[attach]618[/attach]
=========================grid==============================
<div id="treegrid_ValueCode" class="mini-treegrid" style="width: 100%; height: 100%;"
showtreeicon="true" treecolumn="TaskName" idfield="vId" parentfield="vParentId"
resultastree="false" allowresize="true">
<div property="columns">
<div type="indexcolumn">
</div>
<div name="TaskName" field="vName" width="200">
任务名称</div>
<div field="vIsEnableName" width="100">
是否启用</div>
<div width="100%">
</div>
</div>
</div>
=========================js==================================
mini.parse();
var treegrid = mini.get("#treegrid_ValueCode");
var form = new mini.Form("main_Form");
initGrid();
//加载Grid
function initGrid() {
var searchJson = mini.encode(form.getData());
$.ajax({
url: "../MiniService.aspx?method=initValueCodeGrid",
data: { json: searchJson },
type: "POST",
success: function (text) {
try {
var data = mini.decode(text);
treegrid.load(data);
}
catch (err) {
parent.message(text);
}
},
error: function (jqXHR, textStatus, errorThrown) {
parent.message(jqXHR.responseText);
}
});
}
作者:
deartszy
时间:
2012-9-14 17:42:21
用setData和load的方式都不可以显示级次关系
作者:
niko
时间:
2012-9-14 18:20:03
setData需要你组织好一个树形结构数据。
不过下周一的版本,tree会提供loadList方法,可以接收列表数据。
作者:
deartszy
时间:
2012-9-17 09:38:12
呵呵,谢谢解答。。
作者:
deartszy
时间:
2012-9-17 10:31:08
我上午下载了一个新版本但是还是不行。。。。。。。。。我的数据结构如下,求解。。。。。。。[{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10001,"vName":"代理商1","vIndex":0,"vId":0},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10001,"vName":"厂商","vIndex":1,"vId":1},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10003,"vName":"潜在","vIndex":0,"vId":2},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10003,"vName":"正式","vIndex":1,"vId":3},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10002,"vName":"一般","vIndex":0,"vId":4},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10002,"vName":"重要","vIndex":1,"vId":5},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10002,"vName":"非常重要","vIndex":2,"vId":6},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10004,"vName":"电话","vIndex":0,"vId":7},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10004,"vName":"面访","vIndex":1,"vId":8},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10005,"vName":"销售产品","vIndex":0,"vId":9},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10005,"vName":"客户维护","vIndex":1,"vId":10},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10005,"vName":"其他","vIndex":2,"vId":11},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10006,"vName":"初步洽谈","vIndex":0,"vId":12},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10006,"vName":"深入交流","vIndex":1,"vId":13},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10006,"vName":"商务阶段","vIndex":2,"vId":14},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":10006,"vName":"成交阶段","vIndex":3,"vId":15},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":-1,"vName":"客户类型","vIndex":1,"vId":10001},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":-1,"vName":"客户级别","vIndex":2,"vId":10002},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":-1,"vName":"客户状态","vIndex":3,"vId":10003},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":-1,"vName":"拜访方式","vIndex":4,"vId":10004},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":-1,"vName":"拜访目的","vIndex":5,"vId":10005},
{"vIsEnable":1,"vIsEnableName":"启用","vParentId":-1,"vName":"商务阶段","vIndex":6,"vId":10006}]
作者:
factory
时间:
2012-9-17 12:22:20
deartszy 发表于 2012-9-17 10:31
我上午下载了一个新版本但是还是不行。。。。。。。。。我的数据结构如下,求解。。。。。。。[{"vIsEnable ...
请参考示例:
http://www.miniui.com/demo/#src=tree/createtree.html
loadList的那个例子
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2