From 0e3b6628f32ab6cf253bee28d7958b86aabdd0ca Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 14 Feb 2014 08:45:31 -0800 Subject: [PATCH] Call getFilterKey() instead of filterKey ivar --- src/select-list-view.coffee | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/select-list-view.coffee b/src/select-list-view.coffee index e3d369f13..3829644dc 100644 --- a/src/select-list-view.coffee +++ b/src/select-list-view.coffee @@ -136,7 +136,7 @@ class SelectListView extends View filterQuery = @getFilterQuery() if filterQuery.length - filteredArray = fuzzyFilter(@array, filterQuery, key: @filterKey) + filteredArray = fuzzyFilter(@array, filterQuery, key: @getFilterKey()) else filteredArray = @array @@ -214,6 +214,19 @@ g # item - The selected model item. confirmed: (item) -> + # Public: Get the property name to use when filtering items. + # + # This method may be overridden by classes to allow fuzzy filtering based + # on a specific property of the item objects. + # + # For example if the objects you pass to {.setItems} are of the type + # `{"id": 3, "name": "Atom"}` then you would return `"name"` from this method + # to fuzzy filter by that property when text is entered into this view's + # editor. + # + # Returns a {String} property name to fuzzy filter by. + getFilterKey: -> + attach: -> @storeFocusedElement()