温馨提示:本文翻译自stackoverflow.com,查看原文请点击:axapta - Change allowedit on statement

axapta - 声明允许更改

发布于 2020-03-31 23:25:30

我正在尝试在单个字段上更改allowedit值,但无法进入。这是我的实际代码,但出现错误:确实重建了模型,这很好

  [ExtensionOf(formStr(ProdParmReportFinished))]
  final class ProdParmReportFinishedWG_Extension
 {
public void init()
{
    next init();

    ProdTable prodTable;


    select firstOnly RecId from prodTable
        where prodTable.InventRefType != InventRefType::None
           && prodTable.ProdId == prodTable.InventRefId
           && prodTable.ProdStatus != ProdStatus::ReportedFinished;

    prodParmReportFinished_ds.object(fieldNum(ProdParmReportFinished, EndJob)).allowEdit(prodTable.RecId != 0);
}

 }

查看更多

提问者
Radosław Mierzejewski
被浏览
17
Jonathan Bravetti 2020-01-31 23:38

如果您正在使用扩展程序,请尝试这样的事情

[PostHandlerFor(formStr(YourForm), formMethodStr(YourForm, YourMethod))]
    public static void YourForm_xxx(XppPrePostArgs args)
    {
        FormRun sender = Args.getThis();
        sender.control(sender.controlId(formControlStr(YourForm, YourDatasource_Field))).allowEdit(false);
    }

右键单击并选择复制事件处理程序方法,将正确的方法结构复制给您,然后输入代码