One of the great new features of NAV 2015 is the possibility to sort on any column – similar to Excel where you can right click on any column. That feature was actually introduced with NAV 2013 R2. By clicking on the small arrow next to each column you may toggle between ascending and descending order:
Some problems however occur when users are using this feature on pages that show a long list of records. One of our customers has a very high transaction volume and more than 20 million customer ledger entries. If a user by mistake clicks on the “wrong” column – especially on columns that are not covered by good indexes such as the Description-field the client may hang for minutes. Unfortunately NAV does not allow to limit sorting to certain columns – you either have full flexibility or no sorting at all. The contact list is an example where no sorting is possible – this is actually a side-effect of the indentation that this list provides showing contacts next to their company.
Now since it is possible to deactivate the column sorting on very big transaction pages (by means of defining one dummy indentation column), it would still be very nice to provide users some “safe” sorting feature. We have not found anything about this on the web what is why we write this short article.
That feature can be developed with just a few lines of code – it is like bringing back some old feature into NAV. The result will look like the following:
After clicking on the new Change Sort Order Action, a list of all active keys will be shown. Subsequently it is possible to switch between Ascending and Descending order.
Technically the implementation is quite simple – it consists of just a few lines of code.
Please feel free to use the objects (text and fob). Integrating this into any list is quite easy, you just need to copy these three actions and the global variables from page 91004:
It should work out of the box for any record-based tabular page (lists, subpages, worksheets). We hope this is helpful to anyone.