[pmg-devel] [PATCH pmg-gui 4/4] MailTracker: change default emptyText

Dominik Csapak d.csapak at proxmox.com
Fri Apr 24 15:57:56 CEST 2020


by default show that the user first has to press search, and
afterwards show the old emptyText

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 js/MailTracker.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/js/MailTracker.js b/js/MailTracker.js
index f506430..b2a8053 100644
--- a/js/MailTracker.js
+++ b/js/MailTracker.js
@@ -249,7 +249,7 @@ Ext.define('PMG.MailTracker', {
 
     border: false,
 
-    emptyText: gettext('No data in database'),
+    emptyText: gettext("Please enter your search parameters and press 'Search'."),
     disableSelection: true,
 
     viewConfig: {
@@ -279,6 +279,7 @@ Ext.define('PMG.MailTracker', {
 
 	onSearch: function() {
 	    var view = this.getView();
+	    view.setEmptyText(gettext('No data in database'));
 	    var filter = this.lookupReference('filter');
 	    var status = this.lookupReference('status');
 	    var params = filter.getFilterParams();
@@ -333,6 +334,14 @@ Ext.define('PMG.MailTracker', {
 	}
     },
 
+    // extjs has no method to dynamically change the emptytext on
+    // grids, so we have to do it this way
+    setEmptyText: function(emptyText) {
+	let me = this;
+	let tableview = me.getView();
+	tableview.emptyText = `<div class="x-grid-empty">${emptyText || ""}</div>`;
+    },
+
     dockedItems: [
 	{
 	    xtype: 'pmgMailTrackerFilter',
-- 
2.20.1




More information about the pmg-devel mailing list