-->

Modify Selector Default Sorting

2019-07-29 04:11发布

问题:

I want to modify the selector of the Order Nbr field in the SO Order Entry screen to be sorted by the Order Date in descending order by default. I tried to modify the SO.RefNbr adding a Desc<SOOrder.orderType> to the OrderBy<>...

[PXMergeAttributes(Method = MergeMethod.Merge)]
[SO.RefNbr(typeof(Search2<SOOrder.orderNbr,
    LeftJoinSingleTable<Customer, On<SOOrder.customerID, Equal<Customer.bAccountID>,
        And<Where<Match<Customer, Current<AccessInfo.userName>>>>>>,
    Where<SOOrder.orderType, Equal<Optional<SOOrder.orderType>>,
    And<Where<SOOrder.orderType, Equal<SOOrderTypeConstants.transferOrder>,
        Or<Customer.bAccountID, IsNotNull>>>>,
    OrderBy<Desc<SOOrder.orderDate, Desc<SOOrder.orderNbr>>>>), Filterable = true)]
public virtual void SOOrder_OrderNbr_CacheAttached(PXCache sender) { }

However, that had no affect. Interestingly if I remove the Desc<SOOrder.orderNbr> portion of the OrderBy<> term it results in the items in the Selector still being sorted by the Order Nbr but now in Ascending order. Is it possible to sort Selectors by fields other than their referenced search field?

回答1:

Unfortunately the PXSelectorAttribute will only sort by key(foreign) or a substitute key. Any other field used on the sort won't affect the sorting.



标签: acumatica