[pve-devel] [PATCH widget-toolkit v2 1/4] ObjectGrid: optionally show loading mask on load

Aaron Lauterer a.lauterer at proxmox.com
Wed Jul 6 15:01:23 CEST 2022


Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---

changes since v1:
- added description in the documention at the top
- renamed paramter to "maskOnLoad" as I couldn't come up with something
more fitting ;)

 src/grid/ObjectGrid.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/grid/ObjectGrid.js b/src/grid/ObjectGrid.js
index b355d6d..065a009 100644
--- a/src/grid/ObjectGrid.js
+++ b/src/grid/ObjectGrid.js
@@ -39,6 +39,8 @@ disabled:: setting this parameter to true will disable selection and focus on
   the proxmoxObjectGrid as well as greying out input elements. Useful for a
   readonly tabular display
 
+maskOnLoad: if set to true, will show a "Loading..." while the store is loading data
+
 */
 Ext.define('Proxmox.grid.ObjectGrid', {
     extend: 'Ext.grid.GridPanel',
@@ -48,6 +50,8 @@ Ext.define('Proxmox.grid.ObjectGrid', {
     // see top-level doc-comment above for details/example
     gridRows: [],
 
+    maskOnLoad: false,
+
     disabled: false,
     hideHeaders: true,
 
@@ -221,7 +225,10 @@ Ext.define('Proxmox.grid.ObjectGrid', {
 
     reload: function() {
 	let me = this;
-	me.rstore.load();
+	if (me.maskOnLoad) {
+	    me.setLoading();
+	}
+	me.rstore.load({ callback: () => me.setLoading(false) });
     },
 
     getObjectValue: function(key, defaultValue) {
-- 
2.30.2





More information about the pve-devel mailing list