请问在easyui的grid中如何获得combotree的树对象?

calvin_wyx 2012-01-30 05:22:17

我是想在点击combotree的某个树节点时给后面的隐藏域赋值,值包括选择的节点值以及它的父节点的值

function test(record){
var rowIdx = $('#tt').datagrid('getRowIndex',$('#tt').datagrid('getSelected'));
//给隐藏域赋选中的节点的值
$('#tt').datagrid('getEditor',{'index':rowIdx,'field':'hiddenObj'}).target.val(record.id+"~"+record.text);
//如何给隐藏域赋选中节点的父节点的值??
//要不是在grid中我可以直接通过$('#treeObj').combotree('tree').tree('getParent',record.target)
//但是这里无法通过这个写法获得树对象!
}

function init(node, data){
if(data[0]){
//alert(node+", "+$.toJSON(data));
//alert(data[0].id+","+data[0].text);
}
}

$(function(){
$('#tt').datagrid({
onBeforeLoad:function(){
$(this).datagrid('rejectChanges');
},
onClickRow:function(rowIndex){
if (lastIndex != rowIndex){
//$('#tt').datagrid('endEdit', lastIndex);
//$('#tt').datagrid('beginEdit', rowIndex);
}
//lastIndex = rowIndex;
},
onDblClickRow:function(rowIndex){
if (lastIndex != rowIndex){
//$('#tt').datagrid('endEdit', lastIndex);
$('#tt').datagrid('beginEdit', rowIndex);
}
lastIndex = rowIndex;
},
onAfterEdit:function(rowIndex){
//alert("onAfterEdit=="+rowIndex);
},
onCancelEdit:function(rowIndex){
//alert("onCancelEdit=="+rowIndex);
}
});
});


<table id="tt" style="width:850px;height:auto" title="Editable DataGrid" iconCls="icon-edit" singleSelect="true" idField="itemid" url="datagrid_data2.json">
<thead>
<tr>
<th field="itemid" width="80">Item ID</th>
<th field="treeObj" width="160" align="center" editor="{type:'combotree',options:{url:'tree_data.json',onSelect:function(record){test(record);},onLoadSuccess:function(node, data){init(node, data);}}}">tree</th>
<th field="hiddenObj" width="50" editor="text" value="aa">hidden</th>
</tr>
</thead>
</table>
...全文
674 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
mngzilin 2012-09-22
  • 打赏
  • 举报
回复
var tree=XXXXXX.combotree("tree");

这就是tree对象
calvin_wyx 2012-01-31
  • 打赏
  • 举报
回复
哪位帮帮忙啊
calvin_wyx 2012-01-31
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 eval2002 的回复:]
我是想sf999在点击combotree的某个树节1.85狂雷合击版本点时给后面的隐藏域赋1.85必杀元素值,值包括选择的节点值以及它的父节点的
[/Quote]

啥意思呀?现在就是不知道怎么获得父节点的值
calvin_wyx 2012-01-30
  • 打赏
  • 举报
回复
自己顶一下

5,006

社区成员

发帖
与我相关
我的任务
社区描述
解读Web 标准、分析和讨论实际问题、推动网络标准化发展和跨浏览器开发进程,解决各种兼容性问题。
社区管理员
  • 跨浏览器开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧