只有本站会员才能查看附件,请 登录
导入如了:jquery.easyui.min.1.3.2.js,datagrid-detailview.js,jquery-1.8.3.js
页面的代码如下:

<table id="purchaseStateList" url="PurchaseStateController.do?datagrid"></table>
<script type="text/javascript">
$(function(){
$('#purchaseStateList').datagrid({
title: '',
fit:true,
loadMsg: '数据加载中...',
pageSize: 2,
pagination:true,
pageList:[20,40,60],
sortName:'create_date',
sortOrder:'desc',
//fitColumns:true,
singleSelect:true,
nowrap:false,
columns:[[{field:'pur_type',title:'采购单别',sortable:true,width:120,align:"center"},
{field:'pur_no',title:'采购单号',sortable:true,width:120,align:"center"},
{field:'item_num',title:'采购项次',sortable:true,width:120,align:"center"},
{field:'buyer_name',title:'采购员',sortable:true,width:120,align:"center"},
{field:'supplier_name',title:'供应商',sortable:true,width:120,align:"center"},
{field:'taxes',title:'税种',sortable:true,width:120,align:"center",
formatter:function(value){
if(value==null || value==undefined){
return '';
}
//1.应税内含、2.应税外加、3.零税率、4.免税、9.不计税
if(value=='1') return '1.应税内含';
if(value=='2') return '2.应税外加';
if(value=='3') return '3.零税率';
if(value=='4') return '4.免税';
if(value=='9') return '9.不计税';
return '';
}},
{field:'create_date',title:'单据日期',sortable:true,width:120,align:"center"},
{field:'pur_date',title:'采购日期',sortable:true,width:120,align:"center"},
{field:'pur_money',title:'采购金额',sortable:true,width:120,align:"center"},
{field:'verification',title:'审核码',sortable:true,width:120,align:"center",
formatter:function(value){
if(value==null || value==undefined){
return '未审核';
}else{
if(value=='Y') return '已审核';
else return '未审核';
}
}}
]],
onLoadSuccess:function(data){
$("#purchaseStateList").datagrid("clearSelections");
$("#purchaseStateList").datagrid({
view: detailview,
detailFormatter:function(index,row){
return '<div style="padding:2px"><table class="ddv"></table></div>';
},
onExpandRow: function(index,row){
var ddv = $(this).datagrid('getRowDetail',index).find('table.ddv');
console.log("222222222222");
ddv.datagrid({
url:'PurchaseStateController.do?purchaseDetail&pur_type='+row.pur_type+'&pur_no='+row.pur_no,
fitColumns:true,
singleSelect:true,
rownumbers:true,
loadMsg:'',
height:'auto',
columns:[[
{field:'pro_no',title:'品号',width:200},
{field:'pro_name',title:'品名',width:100,align:'right'},
{field:'pro_size',title:'pro_size',width:100,align:'right'}
]],
onResize:function(){
$('#purchaseStateList').datagrid('fixDetailRowHeight',index);
},
onLoadSuccess:function(){
console.log("111111111");
setTimeout(function(){
$('#purchaseStateList').datagrid('fixDetailRowHeight',index);
},0);
}
});
$('#purchaseStateList').datagrid('fixDetailRowHeight',index);
}
});
}
});
});
</script>
<script type="text/javascript">
$(function(){
$('#purchaseStateList').datagrid({
title: '',
fit:true,
loadMsg: '数据加载中...',
pageSize: 2,
pagination:true,
pageList:[20,40,60],
sortName:'create_date',
sortOrder:'desc',
//fitColumns:true,
singleSelect:true,
nowrap:false,
columns:[[{field:'pur_type',title:'采购单别',sortable:true,width:120,align:"center"},
{field:'pur_no',title:'采购单号',sortable:true,width:120,align:"center"},
{field:'item_num',title:'采购项次',sortable:true,width:120,align:"center"},
{field:'buyer_name',title:'采购员',sortable:true,width:120,align:"center"},
{field:'supplier_name',title:'供应商',sortable:true,width:120,align:"center"},
{field:'taxes',title:'税种',sortable:true,width:120,align:"center",
formatter:function(value){
if(value==null || value==undefined){
return '';
}
//1.应税内含、2.应税外加、3.零税率、4.免税、9.不计税
if(value=='1') return '1.应税内含';
if(value=='2') return '2.应税外加';
if(value=='3') return '3.零税率';
if(value=='4') return '4.免税';
if(value=='9') return '9.不计税';
return '';
}},
{field:'create_date',title:'单据日期',sortable:true,width:120,align:"center"},
{field:'pur_date',title:'采购日期',sortable:true,width:120,align:"center"},
{field:'pur_money',title:'采购金额',sortable:true,width:120,align:"center"},
{field:'verification',title:'审核码',sortable:true,width:120,align:"center",
formatter:function(value){
if(value==null || value==undefined){
return '未审核';
}else{
if(value=='Y') return '已审核';
else return '未审核';
}
}}
]],
onLoadSuccess:function(data){
$("#purchaseStateList").datagrid("clearSelections");
$("#purchaseStateList").datagrid({
view: detailview,
detailFormatter:function(index,row){
return '<div style="padding:2px"><table class="ddv"></table></div>';
},
onExpandRow: function(index,row){
var ddv = $(this).datagrid('getRowDetail',index).find('table.ddv');
console.log("222222222222");
ddv.datagrid({
url:'PurchaseStateController.do?purchaseDetail&pur_type='+row.pur_type+'&pur_no='+row.pur_no,
fitColumns:true,
singleSelect:true,
rownumbers:true,
loadMsg:'',
height:'auto',
columns:[[
{field:'pro_no',title:'品号',width:200},
{field:'pro_name',title:'品名',width:100,align:'right'},
{field:'pro_size',title:'pro_size',width:100,align:'right'}
]],
onResize:function(){
$('#purchaseStateList').datagrid('fixDetailRowHeight',index);
},
onLoadSuccess:function(){
console.log("111111111");
setTimeout(function(){
$('#purchaseStateList').datagrid('fixDetailRowHeight',index);
},0);
}
});
$('#purchaseStateList').datagrid('fixDetailRowHeight',index);
}
});
}
});
});
</script>