How to extract column sorting of %ZEN.tablePane with or without snapShot
Hi all,
I've been looking for a way to extract the sorting from the
I could see that if the column is sorted by one column, new entries with this structure are created:
^CacheTemp.zenData(<sessionId>,<snapShotId>,<tablePaneId>,"index",<columnId>,<value>,<dataId>)=""
These are created the first time that the sort criteria is applied (asc) and has the same amount of entries as the data being displayed. But then if I change the criteria to descentant this data dont change and then I cannot differ whether the sorting order.
Is there a way to get the data of the ^CacheTemp.zenData in the same sorting displayed on the page?
Best regars
There is no easy way to achieve this on the server side. But you can easily extract the currently displayed data set on the client. Here is a code snippet that works with the tablePane demo ZENTest.TableTest.cls in the SAMPLES namespace:
The code snippet will render each individual row, respecting the current filtering and order.
Thanks Stefan,
Actually the report is generated on server side, and I would like to avoid to send the data set to the server from client just for this...
Is there any other way?
Thanks in advance
I think you have to manually resort the CacheTemp global into another location based on the sortColumn and sortOrder properties of your table. Some work, but doable. Timothy provided some insight to that approach.
The CacheTemp global mentioned in the original post already has the IDs sorted by sortColumn - it's just a matter of $order-ing over it normally (with $order(global)) or in reverse (with $order(global,-1)) based on the value of sortOrder. This is what the %DrawTable method in %ZEN.Component.tablePane does.
I see. That seems to be a valid approach for the given problem.
Presumably, if you're showing the results in a report sorted based on the currently-selected column (in the currColumn property of the tablePane), you could also look at the sort order for the tablePane (sortOrder property, "asc" or "desc") and then $order over the index global in reverse if it's "desc".
Here's a class query/example that could help - you can modify the ROWSPEC to fit your purposes.
Sample use, against /csp/samples/ZENTest.TableTest.cls (and, in my case, with the class query defined in App.TablePaneUtils):
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue