【问题标题】:Kendo angular Readonly property剑道角只读属性
【发布时间】:2017-05-18 13:53:42
【问题描述】:

我正在使用 Kendo ui 和 Angular 开发一个 Web 项目。我有一个弹出表单,当我单击编辑选项时会得到它。我想根据我的discount 列使我的弹出表单不可编辑。如果 discount 的值为false 我应该可以编辑弹出窗口中的值,否则我将无法编辑它。

这是我的插件网址:http://plnkr.co/edit/yBTf4BbQB7xvQZyHRJXi?p=preview

任何帮助将不胜感激。

谢谢。

【问题讨论】:

    标签: angular kendo-ui


    【解决方案1】:

    在 GridEditFormComponent 中,您将产品模型作为输入。您只需要检查模型值并禁用/启用表单:

    @Input() public set model(product: Product) {
        this.editForm.reset(product);
    
        this.active = product !== undefined;
    
        // if(product) checks if product is not null or undefinded here
        if(product && product.Discontinued) {
          this.editForm.disable();
        }
        else {
          this.editForm.enable();
        }
    }
    

    http://plnkr.co/edit/cA7VzJnFWBFctSZlfrjm?p=preview

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-22
      相关资源
      最近更新 更多