【问题标题】:Kendo ui Calculated Columns with Batch Editing in GridsKendo ui 计算列与网格中的批量编辑
【发布时间】:2019-12-30 01:57:23
【问题描述】:

我在剑道网格here 中有剑道简单演示。

  1. price 将根据quantity 值更改,如果quantity 更改为1,如何恢复默认值?

  2. 以及如何制作价格栏editable:false? (如果设置为 true,价格列不能动态变化)有什么想法吗?

full demo in dojo

save: function(e) {    
  if (e.values.hasOwnProperty("quantity")){
    var current_qty = e.values.quantity;
    var current_price = e.model.price;

    var totalPrice = current_price * current_qty;
    e.model.set('price', totalPrice);

    if(e.values.quantity == 1){
      console.log('set back to default value') ;
    }   
  }
}

【问题讨论】:

    标签: jquery kendo-ui kendo-grid


    【解决方案1】:

    我在这里找到了这个article 可能会有所帮助,在这里找到demo(以防有人需要)。基本上我创建了一个虚拟字段,save 事件分配了总价。

    【讨论】:

      【解决方案2】:

      这是您如何使用计算字段设置列且不可编辑。

      columns: [
           { field: "quantity", title: "quantity", format: "{0:c}" },
           { field: "current_price", title: "current_price", format: "{0:c}" },
           { title: "totalPrice", template: "<span>#= quantity * current_price #</span>", editable: false }],
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-04-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多