Acumatica 属性列表上的PXSelector不按排序器排序

Acumatica 属性列表上的PXSelector不按排序器排序,acumatica,Acumatica,我在自定义DAC/屏幕的字段上设置了PXSelector属性,该屏幕使用Acumatica属性表CSAttributeDetail进行查找,如下所示: [PXSelector(typeof(Search<CSAttributeDetail.valueID, Where<CSAttributeDetail.attributeID, Equal<Constants.toDoType>>,

我在自定义DAC/屏幕的字段上设置了PXSelector属性,该屏幕使用Acumatica属性表CSAttributeDetail进行查找,如下所示:

         [PXSelector(typeof(Search<CSAttributeDetail.valueID, 
                            Where<CSAttributeDetail.attributeID, Equal<Constants.toDoType>>, 
                            OrderBy<Asc<CSAttributeDetail.sortOrder>>>),
                     typeof(CSAttributeDetail.valueID),
                     typeof(CSAttributeDetail.description))]
但是,按顺序似乎没有什么区别。有什么我需要补充的,以确保它的订单排序

以下是属性列表的屏幕截图:


根据设计,PXSelectorAttribute只能按外键或替换键(如果有)排序。任何其他字段的排序都不会起作用。

< P>如果您想以某种特殊的方式排序,可以考虑创建自定义选择器,然后在方法GETReLATE中添加排序条件。 考虑以下代码示例:

public class SelectorCustomerContractAttribute : PXCustomSelectorAttribute
{
    private Type selectorField;
    private Type contractFld;

    public SelectorCustomerContractAttribute(Type selectorField, Type contractField)
        : base(typeof(DRDocumentRecord.refNbr))
    {
        if (selectorField == null)
            throw new ArgumentNullException("selectorField");

        if (contractField == null)
            throw new ArgumentNullException("contractField");


        if (BqlCommand.GetItemType(selectorField).Name != BqlCommand.GetItemType(selectorField).Name)
        {
            throw new ArgumentException(string.Format("moduleField and docTypeField must be of the same declaring type. {0} vs {1}",
                BqlCommand.GetItemType(selectorField).Name, BqlCommand.GetItemType(selectorField).Name));
        }

        this.selectorField = selectorField;
        contractFld = contractField;
    }

    public override void FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
    {           
    }

    protected virtual IEnumerable GetRecords()
    {
        var cache = this._Graph.Caches[BqlCommand.GetItemType(selectorField)];
        var cbs = (ContractBillingSchedule) cache.Current;
        cache = this._Graph.Caches[BqlCommand.GetItemType(contractFld)];
        var contract = (Contract) cache.Current;
        var result = new List<int>();

        if (cbs.BillTo == "M")
        {
            result.Add(1);
        }

        if (cbs.BillTo == "P")
        {
            result.Add(2);
        }
        if (cbs.BillTo == "S")
        {
            result.Add(3);
        }
        result.Add(4);
        return result.OrderBy(a => a.someCriteria);
    }
}
选择器的用法如下所示:

public class ContractBillingScheduleExt : PXCacheExtension<ContractBillingSchedule>
{
    #region UsrCustomerContact
    public abstract class usrCustomerContact : IBqlField, IBqlOperand
    {
    }
    [PXDBInt]
    [SelectorCustomerContract(typeof(ContractBillingSchedule.billTo), typeof(Contract.contractID))]
    [PXUIField(DisplayName = "Customer Contact", Visibility = PXUIVisibility.SelectorVisible)]
    public virtual int? UsrCustomerContact { get; set; }
    #endregion

}

因此,唯一的排序方法是将数字放在值的前面,如00Value1、01Value2、02Value2等。对吗?还有一件事-属性列表生成的组合框如何按排序器排序?不知怎的,它做到了。在我们的网格中有什么方法可以做到这一点吗?你能用排序器排序的属性列表的屏幕截图更新你的初始问题吗?我不知道在哪里可以找到它。完成了。这是一个自定义属性列表。谢谢,彼得!这是一个组合框输入,不是选择器。我的回答是针对PXSelector输入的,而不是PXDropDowns。