Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Use function to clear search
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Gerber committed Oct 18, 2014
1 parent b774672 commit de80ba8
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/extensibility/ExtensionManagerDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,17 @@ define(function (require, exports, module) {
return searchDisabled;
}

function clearSearch() {
$search.val("");
views.forEach(function (view, index) {
view.filter("");
});

if (!updateSearchDisabled()) {
$search.focus();
}
}

// Open the dialog
dialog = Dialogs.showModalDialogUsingTemplate(Mustache.render(dialogTemplate, context));

Expand All @@ -316,7 +327,7 @@ define(function (require, exports, module) {
}
$tab.tab("show");
$(".modal-body", $dlg).scrollTop((models[_activeTabIndex] && models[_activeTabIndex].scrollPos) || 0);
$searchClear.click();
clearSearch();
}

// Dialog tabs
Expand Down Expand Up @@ -402,16 +413,7 @@ define(function (require, exports, module) {
views.forEach(function (view) {
view.filter(query);
});
}).on("click", ".search-clear", function (e) {
$search.val("");
views.forEach(function (view, index) {
view.filter("");
});

if (!updateSearchDisabled()) {
$search.focus();
}
});
}).on("click", ".search-clear", clearSearch);

// Disable the search field when there are no items in the model
models.forEach(function (model, index) {
Expand Down

0 comments on commit de80ba8

Please sign in to comment.