Solved

PXSelector list doesn't sort by lineNbr

  • 11 February 2022
  • 2 replies
  • 252 views

Userlevel 2

Hello,

I want to sort data displayed in PXSelector by LineNbr
here the Selector:

 PXSelector(typeof(Search<Choixfournisseur.inventoryCD, Where<Choixfournisseur.reqNbr, Equal<Current<Choixfournisseur.reqNbr>>>,OrderBy<Asc<Choixfournisseur.lineNbr>>>), new Type[] { typeof(Choixfournisseur.lineNbr), typeof(Choixfournisseur.orderQty),typeof(Choixfournisseur.itemDesc),typeof(Choixfournisseur.curyEstUnitCost),typeof(Choixfournisseur.curyEstExtCost),typeof(Choixfournisseur.inventory) },ValidateValue = false, Filterable = true)]

 

But it dosn’t work 


Thanks for your feedback.
 

icon

Best answer by praveenpo 11 February 2022, 16:08

View original

2 replies

Userlevel 6
Badge +3

Hi @SadokHanini 

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

Just you can give a try with custom selector.

Here is the sample code for custom Selector

        [PXDBString(IsUnicode = true)]
         [TaxzoneSelector]
        [PXUIField(DisplayName = "Tax Zone", Enabled = true)]
        public string TaxZone { get; set; }

        public abstract class taxZone : BqlString.Field<taxZone> { }



 internal class TaxzoneSelectorAttribute : PXCustomSelectorAttribute
    {        
        public PXSelect<TaxZone> Taxzones;
        public TaxzoneSelectorAttribute() : base(typeof(TaxZone.taxZoneID))
        { }
        protected virtual IEnumerable GetRecords()
        {
            object setup = this._Graph.Views["KCFPluginSetup"].Cache.Current;
            CFPluginSetup setup1 = (CFPluginSetup)setup;
            SCPluginSetupExtn extn = setup1.GetExtension<KNSCPluginSetupExtn>();
            if (extn?.TaxZonePreference == SCConstants.ImportManual && !this._Graph.IsCopyPasteContext)
            {
                return PXSelect<TaxZone, Where<TaxZone.isExternal, Equal<False>>>.Select(this._Graph).RowCast<TaxZone>().ToList();
            }
            else
                return PXSelect<TaxZone>.Select(this._Graph).RowCast<TaxZone>().ToList();
        }
    }

 


 

This does not work. The order of the GetRecords does not affect the order of the Selector display at all! I spent numerous hours trying this. I do not understand why Acumatica does not give a solution for this obvious issue.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved