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