diff --git a/nodes/locales/en-US/ui_dropdown.html b/nodes/locales/en-US/ui_dropdown.html index b57e03f6..29cd1936 100644 --- a/nodes/locales/en-US/ui_dropdown.html +++ b/nodes/locales/en-US/ui_dropdown.html @@ -5,6 +5,7 @@
The configured value of the selected item will be returned as msg.payload
.
Setting msg.payload
to one of the item values will preset the choice in the dropdown.
If using the multi-select option then the payload should be an array of values.
Optionally user search term can deleted if set the msg.resetSearch
property is present and true.
Optionally the Topic field can be used to set the msg.topic
property.
The Options may be configured by inputting msg.options
containing an array.
If just text then the value will be the same as the label, otherwise you can specify both by
diff --git a/nodes/ui_dropdown.js b/nodes/ui_dropdown.js
index 604ba46e..4fc43478 100644
--- a/nodes/ui_dropdown.js
+++ b/nodes/ui_dropdown.js
@@ -111,7 +111,9 @@ module.exports = function(RED) {
node.error("ERR: Invalid Options", msg);
}
}
-
+ if (msg.hasOwnProperty("resetSearch") && msg.resetSearch) {
+ emitOptions.resetSearch = true;
+ }
if (msg.hasOwnProperty("payload")) {
if (node.multiple) {
if (typeof msg.payload === "string") {
diff --git a/src/components/ui-component/ui-component-ctrl.js b/src/components/ui-component/ui-component-ctrl.js
index 464830e3..ee78c741 100644
--- a/src/components/ui-component/ui-component-ctrl.js
+++ b/src/components/ui-component/ui-component-ctrl.js
@@ -435,6 +435,10 @@ angular.module('ui').controller('uiComponentController', ['$scope', 'UiEvents',
// may add additional input processing for other controls
var processDropDownInput = function (msg) {
+ // If resetSearch is present, clear user searchTerm input
+ if (msg && msg.resetSearch) {
+ me.searchTerm = "";
+ }
// options should have the correct format see beforeEmit in ui-dropdown.js
if (msg && msg.isOptionsValid) {
me.item.options = msg.newOptions;