Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
I'd like to sort the results loaded to a datatable on the timestamp field, rather than the defaul sort based on the key field. How do I do that? I'm guessing that I'm missing a simple switch or selection box somewhere, but I didn't see it on the configure submenu of the widget.
Thanks,
rob
You can sort it Server Side, with Sort snippet.
Looks like both 'sort' service snippets are for 'infotables' and i cant seem to get either to recognize the datatable. Guessing they're not interchangable. Any other recommendations to sort? There aren't any default thingtemplate services that sort.
You should be able to Sort the "DataTable" with Sort Snippets, just Query the datatable with the corresponding service, which will return an Infotable and then you will be able to sort it. You need to create a new Service which does both, something like this:
var result = Things["YourDataTableThingName"].QueryDataTableEntries({
maxItems: undefined /* NUMBER */,
values: undefined /* INFOTABLE*/,
query: undefined /* QUERY */,
source: undefined /* STRING */,
tags: undefined /* TAGS */
});
result.Sort({ name: "fieldNameToSort", ascending: true });
That may work. In the interim, I've taken a slightly different approach by adding a different column to act as the key. Unfortunately, it is sorting 'ascending' rather than 'descending.' Is there a way to toggle the grid column to sort 'descending' upon mashup load? Otherwise I have to click the column header for the proper sort order each time the mashup is reloaded.
rob
I don't think so