文本框是只读的 [英] Textboxes are read-only

查看:61
本文介绍了文本框是只读的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有桌子:

  • 产品
  • ProductVariant
  • 产品详细信息
  • Product
  • ProductVariant
  • ProductDetails

ProductDetail包含价格,数量,sku,条形码等

ProductDetail has price, quantity, sku, barcode, etc

ProductDetails与Product和ProductVariant的关系为零或一对一(这种方式,我不需要重复的ProductDetails表),因此ProductDetail最终具有Product或ProductVariant

ProductDetails has a zero or one TO one relationship with Product and with ProductVariant (This way I don't need a duplicate ProductDetails table) so a ProductDetail ends up having either a Product or a ProductVariant

在AddEditProduct屏幕上,我有以下代码来创建唯一的ProductDetail:

On the AddEditProduct screen, I have this code to create the unique ProductDetail:

myapp.AddEditProduct.created = function (screen) {
    // Create ProductDetail if it doesn't exist (new entity)
    var entity = screen.Product;
    entity.ProductDetail == null && (entity.ProductDetail = new myapp.ProductDetail);
};

最后一行是Guard Operator(与Guard运算符相同):if(detail == null)detail = new myapp.detail;)

The last line is a Guard Operator (same thing as: if (detail == null) detail = new myapp.detail;)

创建产品时,我可以填写Product.ProductDetail的字段,但是保存后,当我回去对其进行编辑时,这些字段是只读的.我已经调试了几个小时,无法弄清楚发生了什么,请帮忙!

When the product is created, I can fill in the fields of Product.ProductDetail but after I save, the fields are read-only when I go back in to edit them. I have been debugging this for hours and can't figure out what is going on, please help!

推荐答案

嗨.您尝试创建一个已经存在的新productdetail时,改用if语句,但您必须检查是否首先加载了productdetail创建的产品可能会触发得太早,然后is语句可能无法工作Sven
Hi. You are trying to create a new productdetail when it already exist Use a if statement instead but you have to check that productdetail i loaded first The created may fire too soon and then the is statement may not work Sven


这篇关于文本框是只读的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆