这里,我在网格中有一些列,我想在'receivedquantity'字段中给出默认值,默认情况下,收到的数量字段将等于“Quantity”字段。如果用户编辑该字段,那么数据将会到来来自数据库。我在这里使用mvc模式...
this.columns=
[
{
header:'name',
dataIndex:'name'},
{
header:'Quantity',
dataIndex:'quantity',
},
{
header:'Received Quantity',
dataIndex:'receivedquantity',
selectOnFocus: true,
filterable:true,
renderer:function(val, meta, record){
var receivedquantity = record.data.receivedquantity;
var quantity=record.data.quantity;
if(receivedquantity==0)//by default receivedquantity=0
{
//set (receivequantity=quantity) in the grid's received quantity cell
}},
editor: {allowBlank:false
}
}
];
答案 0 :(得分:7)
renderer: function(val, meta, record){
if(val) return val;
return record.get('quantity');
}