+function setColumnSort( $container, $header, direction ) {
+ // $container should be the tbody or whatever has all the infinite table data attributes
+ // $header should be the th with a preset data-sort-order attribute
+ // direction should be "asc" or "desc"
+ // This function returns the order by clause for this column header as a string
+
+ // First reset all sort directions
+ $('th[data-sort-order]').removeData('sort-order-direction');
+ // set the current one
+ $header.data('sort-order-direction', direction);
+ // change the ordering parameter
+ var paramsAttr = 'infinite-content-params-' + $container.data('infinite-content-params-attr');
+ var params = $container.data(paramsAttr) || {};
+ params.order = $header.data('sort-order').split(",").join( ' ' + direction + ', ' ) + ' ' + direction;
+ $container.data(paramsAttr, params);
+ // show the correct icon next to the column header
+ $container.trigger('sort-icons');
+
+ return params.order;
+}
+