DataGrid 显示明细数据

view: detailview,//注意1  
 detailFormatter:function(index,row){//注意2  
         return '<div style="padding:2px"><table id="ddv-' + index + '"></table></div>';  
 },
onExpandRow: function(index,row){  //注意3  
	$('#ddv-'+index).datagrid({  
	url:getContextPath()+'/dispatch/dispatch_queryByDispatchId.action?data='+row.id,
	fitColumns:true,  
	singleSelect:true,  
	rownumbers:true,  
	loadMsg:'',  
	height:'auto',  
	columns:[[  
	{title : 'ID',field : 'id',hidden:true},
	{title:'订单号',field:'orderNo'},
	{title : '订单状态',field :'orderState',formatter:formatOrderState},
	{title : '车数',field : 'carNum'},
	{title : '下单时间',field : 'orderTime'},
	{title : '始发站',field : 'originStop'},
	{title : '目的站',field : 'destination'},
	{title : '要求发车时间',field : 'requreDepatrueTime'},
	{title : '下单网点',field : 'orderDepartment',formatter:formatOrderDepartment},
	{title : '创建人',field : 'createUser'},
	{title : '创建时间',field : 'createTime'},
	{title : '修改人',field : 'updateUser'},
	{title : '最后修改时间',field : 'updateTime'}
	]],  
       onResize:function(){  //注意点4  设置onResize onLoadSuccess 是为了调整展开页面的布局
	$('#dispatchGrid').datagrid('fixDetailRowHeight',index);  
        },  
	onLoadSuccess:function(){  
	    setTimeout(function(){  
	        $('#dispatchGrid').datagrid('fixDetailRowHeight',index);  
		},0);
         } 
      });
     }
  });

    注:1.onExpandRow 下面也可以是panel

     2.除了基本要引入的js,还需要引入datagrid-detailview.js

     3.$('#ddv-'+index) 是对应的<table id="ddv-' + index + '"></table>的id

相关推荐