[pve-devel] [PATCH proxmox-backup] fix #6592: ui: add custom sort function to comment column

Shan Shaji s.shaji at proxmox.com
Tue Aug 5 13:34:12 CEST 2025


When sorting the Comment column, if the `comment` field was
present, the sorting worked correctly. However, when the `comment`
field was missing and only `last-comment` was available (and shown in the UI),
the default Ext JS sorting did not use the `last-comment` value.

To fix this, a custom sort function was added to use the `last-comment``
value when `comment` is empty.

Signed-off-by: Shan Shaji <s.shaji at proxmox.com>
---
 www/datastore/Content.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/www/datastore/Content.js b/www/datastore/Content.js
index 075022e9..a2aa1949 100644
--- a/www/datastore/Content.js
+++ b/www/datastore/Content.js
@@ -1004,6 +1004,15 @@ Ext.define('PBS.DataStoreContent', {
                 return `<span class="snapshot-comment-column ${additionalClasses}">${v}</span>
 		    <i data-qtip="${gettext('Edit')}" style="float: right; margin: 0px;" class="${icon}"></i>`;
             },
+            sorter: (aRec, bRec) => {
+                let a = aRec.data.comment || aRec.data['last-comment'] || '';
+                let b = bRec.data.comment || bRec.data['last-comment'] || '';
+
+                a = a.toLowerCase();
+                b = b.toLowerCase();
+
+                return a.localeCompare(b);
+            },
             listeners: {
                 afterrender: function (component) {
                     // a bit of a hack, but relatively easy, cheap and works out well.
-- 
2.39.5





More information about the pve-devel mailing list