Skip to main content
Solved

PXSelector list doesn't sort by lineNbr

  • February 11, 2022
  • 3 replies
  • 336 views

SadokHanini
Freshman II

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.
 

Best answer by praveenpo

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();
        }
    }

 


 

View original
Did this topic help you find an answer to your question?

3 replies

praveenpo
Semi-Pro II
Forum|alt.badge.img+3
  • Semi-Pro II
  • 99 replies
  • Answer
  • February 11, 2022

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();
        }
    }

 


 


  • Freshman I
  • 2 replies
  • September 14, 2022

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.


Forum|alt.badge.img
  • Jr Varsity III
  • 59 replies
  • May 8, 2024

Hi @julienf99,

Did you get any solution on this?

 

Regards,

Ramya


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings