1

在这里,我在网格中有一些列,我想在“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
     }
            }
                ];
4

1 回答 1

7
renderer: function(val, meta, record){
    if(val) return val;
    return record.get('quantity');
}
于 2013-06-08T08:50:45.307 回答