easyui datagrid-view1和datagrid-view2的区别
1个回答
2016-09-05 · 知道合伙人软件行家
关注
展开全部
datagrid数据绑定
html:
<table id="datagrid" class="easyui-datagrid"
style="width: 99%; height:320px"
data-options="toolbar:'#toolbar',singleSelect:true,collapsible:true,pagination:true,method:'post',pageList:[6],page:1,pageSize:6">
<thead>
<tr>
<th data-options="field:'id',width:150,align:'left',halign:'left'">单据号</th>
<th data-options="field:'financeUserName',width:100,align:'left',halign:'left'">姓名</th>
<th data-options="field:'financeIdentityCard',width:150,align:'left',halign:'left'">证件号</th>
<th data-options="field:'remark',width:210,align:'left',halign:'left'">备注</th>
<th data-options="field:'amount',width:100,align:'right',halign:'right',hidden:true,formatter: function(value,rowData,rowIndex) {
return value.toFixed(2);
}">应收</th>
<th data-options="field:'payType',width:100,align:'center',formatter : function(value, rowData, rowIndex) {
var amount = rowData.amountPaid;
var amBack = rowData.amountBacked;
if(amount!=amBack){
var e = '<input type=\'button\' class=\'btn btn-link\' value=\'退费\' onclick=outMoney(\''+rowData.id+'\',\''+rowData.financeUserName+'\',\''+rowData.financeIdentityCard+'\',\''+rowData.amount+'\',\''+rowData.amountPaid+'\',\''+rowData.amountUnpaid+'\',\''+rowIndex+'\',\''+rowData.amountBacked+'\')//>';
return e;}else{return '已退全额';}}">操 作
</th>
</tr>
</thead>
</table>
绑定数据:
$('#datagrid').datagrid({
url:"../financedocument/page.shtml",
queryParams:postData,
view: detailview,
detailFormatter:function(index,row){
return '<div style="padding:5px"><table class="ddv"></table></div>';
},
onExpandRow: function(index,row){
getFItemDetail(index,row);
}
});
view 明细
function getFItemDetail(index,row){
var ddv = $('#datagrid').datagrid('getRowDetail',index).find('table.ddv');
ddv.datagrid({
url:"../financeitem/feeByDocuNo.shtml?documentId="+row.id,
fitColumns:true,
rownumbers:true,
loadMsg:'',
height:'auto',
columns:[[
{field:'id',width:120,title:'流水号',align:'left',halign:'left'},
{field:'financeObjectId',width:130,align:'center',title:'项目编号',hidden:true},
{field:'financeObjectName',width:130,align:'left',halign:'left',title:'项目名称'},
{field:'createTime',width:130,align:'center',title:'创建时间'}
]],
onResize:function(){
$('#datagrid').datagrid('fixDetailRowHeight',index);
},
onLoadSuccess:function(){
setTimeout(function(){
$('#datagrid').datagrid('fixDetailRowHeight',index);
},0);
}
});
$('#datagrid').datagrid('fixDetailRowHeight',index);
}
html:
<table id="datagrid" class="easyui-datagrid"
style="width: 99%; height:320px"
data-options="toolbar:'#toolbar',singleSelect:true,collapsible:true,pagination:true,method:'post',pageList:[6],page:1,pageSize:6">
<thead>
<tr>
<th data-options="field:'id',width:150,align:'left',halign:'left'">单据号</th>
<th data-options="field:'financeUserName',width:100,align:'left',halign:'left'">姓名</th>
<th data-options="field:'financeIdentityCard',width:150,align:'left',halign:'left'">证件号</th>
<th data-options="field:'remark',width:210,align:'left',halign:'left'">备注</th>
<th data-options="field:'amount',width:100,align:'right',halign:'right',hidden:true,formatter: function(value,rowData,rowIndex) {
return value.toFixed(2);
}">应收</th>
<th data-options="field:'payType',width:100,align:'center',formatter : function(value, rowData, rowIndex) {
var amount = rowData.amountPaid;
var amBack = rowData.amountBacked;
if(amount!=amBack){
var e = '<input type=\'button\' class=\'btn btn-link\' value=\'退费\' onclick=outMoney(\''+rowData.id+'\',\''+rowData.financeUserName+'\',\''+rowData.financeIdentityCard+'\',\''+rowData.amount+'\',\''+rowData.amountPaid+'\',\''+rowData.amountUnpaid+'\',\''+rowIndex+'\',\''+rowData.amountBacked+'\')//>';
return e;}else{return '已退全额';}}">操 作
</th>
</tr>
</thead>
</table>
绑定数据:
$('#datagrid').datagrid({
url:"../financedocument/page.shtml",
queryParams:postData,
view: detailview,
detailFormatter:function(index,row){
return '<div style="padding:5px"><table class="ddv"></table></div>';
},
onExpandRow: function(index,row){
getFItemDetail(index,row);
}
});
view 明细
function getFItemDetail(index,row){
var ddv = $('#datagrid').datagrid('getRowDetail',index).find('table.ddv');
ddv.datagrid({
url:"../financeitem/feeByDocuNo.shtml?documentId="+row.id,
fitColumns:true,
rownumbers:true,
loadMsg:'',
height:'auto',
columns:[[
{field:'id',width:120,title:'流水号',align:'left',halign:'left'},
{field:'financeObjectId',width:130,align:'center',title:'项目编号',hidden:true},
{field:'financeObjectName',width:130,align:'left',halign:'left',title:'项目名称'},
{field:'createTime',width:130,align:'center',title:'创建时间'}
]],
onResize:function(){
$('#datagrid').datagrid('fixDetailRowHeight',index);
},
onLoadSuccess:function(){
setTimeout(function(){
$('#datagrid').datagrid('fixDetailRowHeight',index);
},0);
}
});
$('#datagrid').datagrid('fixDetailRowHeight',index);
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询