XRT
Sorting the table on one column is fairly easy, but know I am trying to sort the table on more than one column. Is there some functionality present in table that allows multicolumn sorting or will something be provided in the future ?
The ability to sort on multiple columns in table is a feature that has already been provided. No new function or resource will be added to table that will specifically address multicolumn sorting in XRT/table. As mentioned, multicolumn sorting is quite possible to do at this point in time. To begin with, you will need to understand that the sort routine supplied to you with XRT/table is not binding. By this I mean you can write your own compare routine. This new compare routine will be the place that provides multiple column sorting.
The last trick to performing multiple column sorting in XRT/table is to understand the algorithm required to produce the desired results. The main idea behind multicolumn sorting is that you have say a primary sort key and a secondary sort key. When given two elements from the primary key, a comparision is done. If these elements are equal to one another, then two elements from the secondary sort key are used.
The attached sample program is an example of how you would implement multicolumn sorting in XRT/table. This sample program also demonstrates how you would use 2 columns that are of different data types (ie: primary column is a string and secondary is a integer). This sample program can also be exampded easily to include a tertiary column. Note, if you want to sort using columns that are not side-by-side, you may have to pass the column numbers into this routine. One way to do this is to use XmNxrtTblUserData to pass the information in.
© 2021 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy