[[VIEW_SORT:columnname]]
Sorts the current view ascending by selected column name. The view ($TerraDctl_view) variable contains an associative array of fields for each row which is populated upon each datafeed view refresh. To refresh the view array, save the datafeed first or use the VIEW_DATAFEED shortcode before, otherwise view may not display.
columnname (string value or php$ variable.)
example:
[[LOAD_DATAFEED:csv_datafeed.txt|,]] [[VIEW_DATAFEED]] [[cr]][[cr]]Before Sorting:[[cr]][[cr]] [[:var_dump($TerraDctl_view)]] [[VIEW_SORT:color]] [[cr]][[cr]]After Sorting:[[cr]][[cr]] [[:var_dump($TerraDctl_view)]]
Output:
<br /><br />Before Sorting:<br /><br /> array(3) { [1]=> array(4) { ["name"]=> string(10) "Washington" ["id"]=> string(1) "1" ["color"]=> string(4) "blue" ["size"]=> string(3) "big" } [2]=> array(4) { ["name"]=> string(6) "Oregon" ["id"]=> string(1) "2" ["color"]=> string(7) ""green"" ["size"]=> string(5) "small" } [3]=> array(4) { ["name"]=> string(10) "California" ["id"]=> string(1) "3" ["color"]=> string(3) "red" ["size"]=> string(4) "huge" } } <br /><br />After Sorting:<br /><br /> array(3) { [0]=> array(4) { ["name"]=> string(6) "Oregon" ["id"]=> string(1) "2" ["color"]=> string(7) ""green"" ["size"]=> string(5) "small" } [1]=> array(4) { ["name"]=> string(10) "Washington" ["id"]=> string(1) "1" ["color"]=> string(4) "blue" ["size"]=> string(3) "big" } [2]=> array(4) { ["name"]=> string(10) "California" ["id"]=> string(1) "3" ["color"]=> string(3) "red" ["size"]=> string(4) "huge" } }
Sorts the current view listing array by color ascending. Note that the first color in the sorted result is “green”. This is because of the quotes in the stored data causing the sort order to change.
For Descending sort add _DESC to shortcode tag.
[[VIEW_SORT_DESC:name]]