ui: storage content view: add clear trigger to search

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-11-16 09:58:22 +01:00
parent 1d8306e4ca
commit c8a71b9e1f

View File

@ -288,21 +288,41 @@ Ext.define('PVE.storage.ContentView', {
xtype: 'textfield', xtype: 'textfield',
width: 200, width: 200,
enableKeyEvents: true, enableKeyEvents: true,
emptyText: gettext('Name, Format'),
listeners: { listeners: {
buffer: 500, keyup: {
keyup: function(field) { buffer: 500,
store.clearFilter(true); fn: function(field) {
store.filter([ store.clearFilter(true);
{ store.filter([
property: 'text', {
value: field.getValue(), property: 'text',
anyMatch: true, value: field.getValue(),
caseSensitive: false anyMatch: true,
} caseSensitive: false,
]); },
} ]);
} },
} },
change: function(field, newValue, oldValue) {
if (newValue !== this.originalValue) {
this.triggers.clear.setVisible(true);
}
},
},
triggers: {
clear: {
cls: 'pmx-clear-trigger',
weight: -1,
hidden: true,
handler: function() {
this.triggers.clear.setVisible(false);
this.setValue(this.originalValue);
store.clearFilter();
},
},
},
},
); );
let availableColumns = { let availableColumns = {