We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

How to control order of the columns in a pivoted view (not flat)?

Answered
Jason asked on March 28, 2023

Need the ability to control order of the columns in the pivoted view and not just in the flat view

9 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster March 29, 2023

Hello, Jason!

Thank you for reaching out to us.

Flexmonster has multiple sorting options in the pivot view: 

  • Values can be sorted by clicking the arrow icon on the member. It appears when hovering over member names or total cells. Also, values can be sorted from the cell's context menu, opened by right-clicking the cell.
  • To sort members, use the AZ and ZA toggle buttons in the filter pop-up to sort field members in alphabetical and reverse alphabetical orders.

Check out the JSFiddle example with both described sorting methods combined. Here, the "Category" members are sorted alphabetically, and values associated with the "Cars" member are sorted descendingly. Please note that you can only set sort order once for columns and rows.

You are welcome to write us if more questions arise.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster April 11, 2023

Hello, Jason!

Hope you are doing well.
We are wondering if you had time to check the provided instructions for sorting the pivot table.
Please let us know if this information helped you.

Best Regards,
Maksym

Public
Jason April 13, 2023

Hi Maksym, thanks for the comment.
So what I am actually interested in is the order of the columns (not the values themselves). So in the pivoted view it appears that the columns seem to be sorted alphabetically but I have some use cases where I do not want the columns themselves ordered left to right alphabetically in pivot view but with a different order that I want to designate.
Is there a feature in flexmonster I can enable to allow that?

Public
Maksym Diachenko Maksym Diachenko Flexmonster April 14, 2023

Hello, Jason!

Thank you for your reply.
Could you please provide us with more information and screenshots to help us better understand the desired sorting result? This would greatly help us to provide a more accurate response.
Looking forward to hearing from you.

Best Regards,
Maksym

Public
Jason April 19, 2023

I've attached a rough example (with dummy data) where I am pulling a field into the column section in the pivoted (shown here as the Entity Name) and I want to order the Entity Name column values in a custom way but as shown in the second screenshot I can only sort AZ/ZA.

Note: this is not a great example but the concept still stands of wanting the order of the values in the column section in a custom way besides AZ/ZA

Public
Maksym Diachenko Maksym Diachenko Flexmonster April 19, 2023

Hello, Jason!

Thank you for providing more details.
Flexmonster allows programmatically setting the custom order for member columns using the sortingMethod API call. This method uses the comparator function, similar to JavaScript's Array.prototype.sort() method. You are welcome to check the JSFiddle example: https://jsfiddle.net/flexmonster/c15n2ykj/ 
Please let us know if the suggested approach would work for you.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster April 20, 2023

Hello, Jason!

We would like to additionally mention another method of configuring the custom sorting - using the sortOrder property. This property should contain an array of all members in the desired order. Check out our documentation page for more information: https://www.flexmonster.com/doc/sorting/#define-sorting-in-array 
Looking forward to hearing your feedback.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster May 2, 2023

Hi, Jason!

Hope you are doing well.
Our team is wondering if you had time to test the suggested approaches for arranging the members in a custom order. 
Looking forward to your response.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster May 16, 2023

Hi, Jason!

Just checking in to ask if you have already tried the provided methods for custom sorting.
Please let us know if you found them helpful in achieving the desired functionality.

Best Regards,
Maksym

Please login or Register to Submit Answer