Closed
Bug 734198
Opened 13 years ago
Closed 13 years ago
Contacts API: Add Sorting
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla14
People
(Reporter: gwagner, Assigned: gwagner)
Details
Attachments
(1 file, 2 obsolete files)
14.89 KB,
patch
|
bent.mozilla
:
review+
|
Details | Diff | Splinter Review |
We should support sorting by field for find results. Like { sortBy: familyName, sortOrder: descending}.
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → anygregor
Assignee | ||
Comment 1•13 years ago
|
||
Assignee | ||
Comment 2•13 years ago
|
||
Attachment #611097 -
Attachment is obsolete: true
Attachment #611559 -
Flags: review?(bent.mozilla)
Comment on attachment 611559 [details] [diff] [review]
patch
Review of attachment 611559 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/contacts/fallback/ContactDB.jsm
@@ +377,5 @@
> }
> }
>
> + // Sorting functions takes care of limit if set.
> + let limit = options.sortBy !== 'undefined' ? null : options.filterLimit;
Hm, should that be testing against 'undefined'? Looks like you always define it to '' if it wasn't passed in...
Also, any time you are going to do something based on both branches of an if statement (in this case the ? operator) I think it's nicer to test against a non-negated condition (e.g. |options.sortBy === 'undefined' ? options.filterLimit : null|).
@@ +413,5 @@
> debug("ContactDB:_findAll: " + JSON.stringify(options));
> if (!txn.result)
> txn.result = {};
> + // Sorting functions takes care of limit if set.
> + let limit = options.sortBy !== 'undefined' ? null : options.filterLimit;
here too.
Assignee | ||
Comment 4•13 years ago
|
||
(In reply to ben turner [:bent] from comment #3)
> Comment on attachment 611559 [details] [diff] [review]
> patch
>
> Review of attachment 611559 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: dom/contacts/fallback/ContactDB.jsm
> @@ +377,5 @@
> > }
> > }
> >
> > + // Sorting functions takes care of limit if set.
> > + let limit = options.sortBy !== 'undefined' ? null : options.filterLimit;
>
> Hm, should that be testing against 'undefined'? Looks like you always define
> it to '' if it wasn't passed in...
>
> Also, any time you are going to do something based on both branches of an if
> statement (in this case the ? operator) I think it's nicer to test against a
> non-negated condition (e.g. |options.sortBy === 'undefined' ?
> options.filterLimit : null|).
Actually the options object isn't created by the constructor. So the values are undefined.
Assignee | ||
Comment 5•13 years ago
|
||
Attachment #611559 -
Attachment is obsolete: true
Attachment #611622 -
Flags: review?(bent.mozilla)
Attachment #611559 -
Flags: review?(bent.mozilla)
Comment on attachment 611622 [details] [diff] [review]
patch
Review of attachment 611622 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/contacts/ContactManager.js
@@ +18,5 @@
> Cu.import("resource://gre/modules/XPCOMUtils.jsm");
> Cu.import("resource://gre/modules/Services.jsm");
> Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
>
> +XPCOMUtils.defineLazyGetter(Services, "DOMRequest", function() {
This change doesn't seem strictly related, but ok.
Attachment #611622 -
Flags: review?(bent.mozilla) → review+
Assignee | ||
Comment 7•13 years ago
|
||
Comment 8•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•