Default filter to All Catalogues and show nodes for small lists

This commit is contained in:
Nick O'Leary 2023-09-05 17:49:50 +01:00
parent 3a6078a56a
commit ab6d537c3e
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 3 additions and 2 deletions

View File

@ -494,6 +494,7 @@ RED.palette.editor = (function() {
// if there is only 1 catalog, hide the select
if (catalogEntries.length > 1) {
catalogSelection.prepend(`<option value="all">${RED._('palette.editor.allCatalogs')}</option>`)
catalogSelection.val('all')
catalogSelection.removeAttr('disabled') // permit the user to select a catalog
}
// refresh the searchInput counter and trigger a change
@ -523,7 +524,7 @@ RED.palette.editor = (function() {
function refreshFilteredItems() {
packageList.editableList('empty');
var currentFilter = searchInput.searchBox('value').trim();
if (currentFilter === ""){
if (currentFilter === "" && loadedList.length > 20){
packageList.editableList('addItem',{count:loadedList.length})
return;
}
@ -893,7 +894,7 @@ RED.palette.editor = (function() {
delay: 300,
change: function() {
var searchTerm = $(this).val().trim().toLowerCase();
if (searchTerm.length > 0) {
if (searchTerm.length > 0 || loadedList.length < 20) {
filteredList = loadedList.filter(function(m) {
return (m.index.indexOf(searchTerm) > -1);
}).map(function(f) { return {info:f}});