From 938b65d88047c34c054204f75cbfcea4dfd297ed Mon Sep 17 00:00:00 2001 From: Glade Date: Tue, 12 Feb 2019 09:56:21 +1100 Subject: [PATCH] callback to filter items before adding (#485) * Add item custom callback * Minor unit test updates * Test updates, Changed callback name to more clearly distinguish it's function * Fix description wording in cypress * Update README * Updated filter item callback name to be addItemFilter --- test/text.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/text.html b/test/text.html index cc5d648..dd7427f 100644 --- a/test/text.html +++ b/test/text.html @@ -64,6 +64,11 @@ +
+ + +
+
@@ -120,6 +125,12 @@ addItems: false, }); + new Choices('#choices-add-item-callback', { + addItemFilter: function (value) { + return (value !== 'test') + } + }); + new Choices('#choices-disabled-via-attr'); new Choices('#choices-prepend-append', {