【问题标题】:set default value of a column extjs设置列extjs的默认值
【发布时间】:2013-06-08 06:40:37
【问题描述】:

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

【问题讨论】:

  • 您希望默认值仅显示在网格中,还是在商店中表示?
  • 从你的编辑我猜你只是想渲染它..
  • 暂时只需要显示

标签: extjs extjs-mvc


【解决方案1】:
renderer: function(val, meta, record){
    if(val) return val;
    return record.get('quantity');
}

【讨论】:

  • 我不明白.. 你能不能再详细点?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-02
  • 1970-01-01
  • 2013-02-03
  • 2015-07-09
  • 1970-01-01
  • 2017-07-17
相关资源
最近更新 更多