Column Indenting and Disabling Interactive Sorting in Microsoft Dynamics NAV 2015
Microsoft Dynamics NAV 2013 R2 introduced the concept of interactive column sorting on list pages such as Sales Lines or the Chart of Accounts. This is a very handy feature, but at times, an errant click can send the data into a sort that you can't get back to unless you close the page and re-open it. For example, the default Sort on Sales Order lines is "Document Type," "Document No.," "Line No.," and since "Line No." isn't by default displayed, you can't get back to the default sort.
However, in NAV 2015, you can disable/break/turn off interactive column sorting on List pages by setting the IndentationColumnName property on the repeater group to an integer value of zero. Below, I'll show interactive sorting, explain why Microsoft might have disabled sort on pages with indented data, and how and what that property controls so you understand what you're doing when we turn the sort "off" on Pages where you don't want sorting and also don't need column indentation.
Below are screen shots of the NAV 2013 R2 Chart of Accounts List.
Screen shot #1 is the default view looking at the page sorted by the G/L Account No.
Figure 1 – Default view looking at the page sorted by the G/L Account No.
Screen shot #2 and #3 show interactive sort in action.
Figure 2 – Screen shot showing interactive sort in action (down).
Figure 3 – Screen shot showing interactive sort in action (up).
Click the "Income/Balance" header again and we get to screen shot #3.
Chart of Accounts - NAV 2015
If you go to the Chart of Accounts in Dynamics NAV 2015, the ability to sort is gone. Why? My guess is that interactive sorting was turned off in NAV 2015 on pages with indented data because the re-sorting makes the structure irrelevant.
Figure 4 – View of Chart of Accounts in NAV 2015 with sorting disabled
What exactly does the IndentationColumnName control? This repeater property takes an integer value and sets how far to the right an indented a column will be.
Designing a page with a Repeater Group
The Chart of Accounts indentation level comes from the G/L Accounts table "Indentation" whose value is passed on the page to the property "IndentationColumnName". Which is how you see "Current Assets" indented under ASSETS and "Liquid Assets" indented slightly more than the row above in and so on.
Figure 5 – Defining properties for IndentationColumnName and Repeater to control indentation levels
G/L Account Table data
So, knowing that setting this property turns off interactive sorting in NAV 2015 and its integer value controls how indented one row is relative to its starting position in a column, we can "break" or turn off interactive column sorting by just setting IndentationColumnName to Zero, which will keep all columns at their default indentation.
Figure 6a – Setting the indentation levels of various entries
Figure 6b – Viewing the indentation levels of the entries in Figure 6a
Jon Long, My ArcherPoint colleague, pointed out that another solution would be to add a button to a subpage to set it back to the default sort. For this to work you need to create a function on the table with a SETCURRENTKEY in it and call it from the page. I like this solution better, but I'll leave it up to you to decide how best to solve.
If you have any further questions about this or other development issues, please contact one of our development experts at ArcherPoint. If you enjoyed this blog, check out our collection of Development Blogs.