Skip to content

Commit 72b7b3e

Browse files
RodrigoSMarquesphillwiggins
authored andcommitted
Fix OrderBy multiple columns (parse-community#241)
* fix some issues * Update README.md * Fix OrderBy multiple columns
1 parent c0efd4e commit 72b7b3e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/src/network/parse_query.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,23 @@ class QueryBuilder<T extends ParseObject> {
3232
/// [String] order will be the column of the table that the results are
3333
/// ordered by
3434
void orderByAscending(String order) {
35-
limiters['order'] = order;
35+
if (limiters.isEmpty) {
36+
limiters['order'] = order;
37+
} else {
38+
limiters['order'] = limiters['order'] + ',' + order;
39+
}
3640
}
3741

3842
/// Sorts the results descending order.
3943
///
4044
/// [String] order will be the column of the table that the results are
4145
/// ordered by
4246
void orderByDescending(String order) {
43-
limiters['order'] = '-$order';
47+
if (limiters.isEmpty) {
48+
limiters['order'] = '-$order';
49+
} else {
50+
limiters['order'] = limiters['order'] + ',' + '-$order';
51+
}
4452
}
4553

4654
/// Define which keys in an object to return.

0 commit comments

Comments
 (0)