【问题标题】:Custom Selector not refreshing when placed in Grid放置在网格中时自定义选择器不刷新
【发布时间】:2018-04-09 17:54:06
【问题描述】:

我有一个使用 PXCustomSelectorAttribute 类创建的自定义选择器,我无法执行自动刷新,因为此选项不可用。谁能告诉我如何自动刷新自定义选择器。

【问题讨论】:

    标签: acumatica


    【解决方案1】:

    以下是如何创建自定义选择器并将其设置为自动刷新模式的示例。

    using PX.Objects.SO;
    using PX.Objects.AR;
    using PX.Data;
    using System.Collections;
    
    namespace TestLib
    {
        public class SOOrderExt : PXCacheExtension<SOOrder>
        {
            #region UsrTestField
            [PXDBString]
            [PXUIField(DisplayName = "TestField")]
            [CustomerPriceClass()]
            public virtual string UsrTestField { get; set; }
    
            public abstract class usrTestField:IBqlField {  }
            #endregion
        }
    
        public class CustomerPriceClassAttribute : PXCustomSelectorAttribute
        {
            public CustomerPriceClassAttribute()
            : base(typeof(ARPriceClass.priceClassID))
            {
                this.DescriptionField = typeof(ARPriceClass.description);
            }
            protected virtual IEnumerable GetRecords()
            {
                ARPriceClass epc = new ARPriceClass();
                epc.PriceClassID = ARPriceClass.EmptyPriceClass;
                epc.Description = PX.Objects.AR.Messages.BasePriceClassDescription;
                yield return epc;
                foreach (ARPriceClass pc in PXSelect<ARPriceClass>.
                Select(this._Graph))
                {
                    yield return pc;
                }
            }
        }
    }
    

    在此之后,您需要从 Layout Editor 将字段添加到 UI,并将 Ext Properties 部分中的 AutoRefresh 属性设置为 True。请参阅下面的屏幕截图。

    更新:

    如果您需要添加网格,则需要在网格的层级中添加控件,如下面的屏幕截图所示:

    添加控件后,您将看到该字段的字段编辑器 (3)。

    在字段编辑器的属性中,可以使用 AutoRefresh,您可以将其设置为 True:

    【讨论】:

    • 我已经以类似的方式完成了,但是在将控件添加到网格之后。我没有看到自动刷新属性。在上面的屏幕截图中,它是表单,但我的要求是将它添加到网格中。
    • @PrathyushaMelapindi 我已经更新了我对网格情况的回答
    猜你喜欢
    • 1970-01-01
    • 2013-12-02
    • 1970-01-01
    • 1970-01-01
    • 2011-04-28
    • 1970-01-01
    • 1970-01-01
    • 2015-10-18
    • 2012-08-23
    相关资源
    最近更新 更多