We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f7827fc commit dcc4faeCopy full SHA for dcc4fae
1 file changed
QueryableList/Base.py
@@ -178,6 +178,17 @@ def count(self):
178
179
180
def sort_by(self, fieldName, reverse=False):
181
+ '''
182
+ sort_by - Return a copy of this collection, sorted by the given fieldName.
183
+
184
+ The fieldName is accessed the same way as other filtering, so it supports custom properties, etc.
185
186
+ @param fieldName <str> - The name of the field on which to sort by
187
188
+ @param reverse <bool> Default False - If True, list will be in reverse order.
189
190
+ @return <QueryableList> - A QueryableList of the same type with the elements sorted based on arguments.
191
192
return self.__class__(
193
sorted(self, key = lambda item : self._get_item_value(item, fieldName), reverse=reverse)
194
)
0 commit comments