日期:2014-05-17 浏览次数:20783 次
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>
&