Solved

Overriding PXSelectOrderBy Sorting

  • 4 March 2022
  • 6 replies
  • 350 views

In 2020 R1, there were some screens (i.e. Customer Details, Inventory Allocation) where the results grid sorted ascending (oldest date first).  Acumatica changed this in 2021 R1 to sort descending.  Below is a snippit from the ARDocumentEnq graph where the code that was changed and I cant figure out a way to override the PXSelectOrderBy statement.  The Documents view is what is feeding the grid data.  I know the simplest thing to do is to resort the grid by clicking on the header, but our users have not had to do this for so long that they asked to see if there was a way to override this.  Can anyone let me know if you know how to get past this.

Thanks Everyone

 

#region Selects
        public PXFilter<ARDocumentFilter> Filter;
        [PXFilterable]
        public PXSelectOrderBy<ARDocumentResult, OrderBy<Desc<ARDocumentResult.docDate>>> Documents;
        public PXSetup<ARSetup> ARSetup;
        public PXSetup<Company> Company;

#endregion

icon

Best answer by Naveen Boga 4 March 2022, 17:31

View original

6 replies

Userlevel 6
Badge +3

Hi @mgygi76,

Have the same Bql with changing order by with same view Name in extension graph.

Userlevel 7
Badge +17

@mgygi76  If you wanted to see in the ascending order like in the old version 20 R1, it is not required for any overriding of PXSelectorOrderBy<>.

It requires a small piece of customization that you need to extend the “ARDocumentEnq” graph and have the same view with ascending order like below. 

 

    public class ARDocumentEnqExt : PXGraphExtension<ARDocumentEnq>
{
[PXFilterable]
public PXSelectOrderBy<ARDocumentResult, OrderBy<Asc<ARDocumentResult.docDate>>> Documents;
}

 

Hope this helps!

I did try this and we are on the right track, however now the grid will not filter when you use the selectors on the form.  It also now pre-populates the grid with all results, instead of waiting for the filters to be populated first.  Any thoughts?

 

 

Userlevel 7
Badge +17

Hi, @mgygi76  Sorry, I have NOT verified the above code, and even I’m facing the same issue.

Can you please try with the code and verify.

 public class ARDocumentEnqExt : PXGraphExtension<ARDocumentEnq>
{
public PXSelectOrderBy<ARDocumentResult, OrderBy<Asc<ARDocumentResult.docDate>>> Documents;



public delegate IEnumerable documentsDelegate();
[PXOverride]
public IEnumerable documents(documentsDelegate baseDelegate)
{
foreach (ARDocumentResult row in baseDelegate())
{
var foundRow = (ARDocumentResult)Base.Documents.Cache.Locate(row);
yield return row;
}
}
}

 

I just verified from my end and it seems it is working!!

Thank you so much that did the trick!

Userlevel 7
Badge +17

Awesome @mgygi76  Thanks for sharing the update!

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