Skip to content

Commit

Permalink
Allow for alternate ascending and descending prefixes, fixes #15047 !…
Browse files Browse the repository at this point in the history
…strict
  • Loading branch information
kriszyp committed Mar 14, 2013
1 parent 7745b40 commit c31e7ce
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion store/JsonRest.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ return declare("dojo.store.JsonRest", base, {
// the sort information is included in a functional query token to avoid colliding
// with the set of name/value pairs.

// ascendingPrefix: String
// The prefix to apply to sort attribute names that are ascending
ascendingPrefix: "+",

// descendingPrefix: String
// The prefix to apply to sort attribute names that are ascending
descendingPrefix: "-",


get: function(id, options){
// summary:
// Retrieves an object by its identity. This will trigger a GET request to the server using
Expand Down Expand Up @@ -167,7 +176,7 @@ return declare("dojo.store.JsonRest", base, {
query += (query || hasQuestionMark ? "&" : "?") + (sortParam ? sortParam + '=' : "sort(");
for(var i = 0; i<options.sort.length; i++){
var sort = options.sort[i];
query += (i > 0 ? "," : "") + (sort.descending ? '-' : '+') + encodeURIComponent(sort.attribute);
query += (i > 0 ? "," : "") + (sort.descending ? this.descendingPrefix : this.ascendingPrefix) + encodeURIComponent(sort.attribute);
}
if(!sortParam){
query += ")";
Expand Down

0 comments on commit c31e7ce

Please sign in to comment.