I have not seen any tools for sorting tables (lists of lists) ascending and descending by columns other than column 1, so here is a blocks library and a way to specify the sort order.
This only sorts by a single column at a time, and uses no extensions or Web View components.
The sort is via value procedure, so the output of one sort can be fed directly into another sort or one of the many table view techniques available on this board.
This also works on one dimensional lists.
Ascending Sort order specifications can be:
empty text
asc
ascending
a positive column number (for sorting tables)
Descending sort order specifications can be:
a negative column number (-2 = sort by column 2, descending)
anything else that doesn't match anything above (desc, descending, -, etc.)
(Note how upper and lower case of the same letter are brought together in the sort, and numbers sort separately and numerically)
Example of sorting by column 2. Notice how unfortunately, I have not yet figured out how to maintain the order of equal valued items. Good thing this is open source, huh?
I won't ask how to sort in descending order, since the output could be run through the reverse list block to achieve that.
There is a case for customization of the string comparison core of the sort, for people who care about clustering the lower and upper case versions of the same letter. I deal with that by downcasing text values before comparing them, but leaving their values intact...
a
A
b
B
Unfortunately, AI2 has no facilities for passing a compare function as parameter in a procedure call, so JavaScript wins in the higher complexity arena.
and I notice that you are using "list from csv row" block,this maybe cause some mistake.
This block will take the number as a string,you will get this:
"12"<"15"<"6"
So better to use "Web.jsonTextDecode" block to get a list from string.
I didn't know you could just use "AppInventor" instead of "window.AppInventor" with the webviewstring? Does this work in all settings, html files etc. ?