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 に答える