请问在easyui的grid中如何获得combotree的树对象?
我是想在点击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>