设置列extjs的默认值

Mir*_*war 1 extjs extjs-mvc

在这里,我在网格中有一些列,我想在'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
     }
            }
                ];
Run Code Online (Sandbox Code Playgroud)

Ami*_*viv 7

renderer: function(val, meta, record){
    if(val) return val;
    return record.get('quantity');
}
Run Code Online (Sandbox Code Playgroud)