Sorts the rows ( {@link Row}) based on {@link #getSortAscending}and {@link #getSortDescending}, if {@link #getSortDirection} doesn'tmatches the ascending argument.
It checks {@link #getSortDirection} to see whether sortingis required, and update {@link #setSortDirection} after sorted.For example, if {@link #getSortDirection} returns "ascending" andthe ascending argument is false, nothing happens. To enforce the sorting, you can invoke {@link #setSortDirection}with "natural" before invoking this method. Alternatively, you can invoke {@link #sort(boolean,boolean)} instead.
It sorts the rows by use of {@link Components#sort}, if not live data (i.e., {@link Grid#getModel} is null).
On the other hand, it invokes {@link ListModelExt#sort} to sortthe rows, if live data (i.e., {@link Grid#getModel} is not null).In other words, if you use the live data, you have to implement {@link ListModelExt} to sort the live data explicitly.
@param ascending whether to use {@link #getSortAscending}. If the corresponding comparator is not set, it returns false and does nothing.
@return whether the rows are sorted.
@exception UiException if {@link Grid#getModel} is notnull but {@link ListModelExt} is not implemented.