]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Fix sorting formatted values in tables
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 13 Dec 2015 12:50:08 +0000 (13:50 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 13 Dec 2015 12:50:08 +0000 (13:50 +0100)
gui/baculum/protected/JavaScript/slide-window.js
gui/baculum/protected/Portlets/ClientList.tpl
gui/baculum/protected/Portlets/JobList.tpl
gui/baculum/protected/Portlets/PoolList.tpl

index 03ac2f7d0b31b5641384b811f4673a197ff51d57..41cf7c1b3d0d23f26227f1dad426a4744b7c779f 100644 (file)
@@ -304,9 +304,16 @@ var SlideWindowClass = Class.create({
                var tb = table.tBodies[0], tr = Array.prototype.slice.call(tb.rows, 0), i;
                reverse = -((+reverse) || -1);
                tr = tr.sort(function (a, b) {
-                       var val;
-                       var val_a = a.cells[col].textContent.trim();
-                       var val_b = b.cells[col].textContent.trim();
+                       var val, val_a, val_b, el_a, el_b;
+                       el_a = a.cells[col].childNodes[1];
+                       el_b = b.cells[col].childNodes[1];
+                       if (el_a && el_b && el_a.nodeType === 1 && el_b.nodeType === 1 && el_a.hasAttribute('rel') && el_b.hasAttribute('rel')) {
+                               val_a = el_a.getAttribute('rel');
+                               val_b = el_b.getAttribute('rel');
+                       } else {
+                               val_a = a.cells[col].textContent.trim();
+                               val_b = b.cells[col].textContent.trim();
+                       }
                        if (!isNaN(parseFloat(val_a)) && isFinite(val_a) && !isNaN(parseFloat(val_b)) && isFinite(val_b)) {
                                val = val_a - val_b
                        } else {
index 5ee46995ca310d35a696a9263f046f41a10ce265..59388ab0a4a8d2d298cb1a19f6570911e7d9e05d 100644 (file)
@@ -34,7 +34,7 @@
                        </com:TActiveTemplateColumn>
                        <com:TActiveTemplateColumn HeaderText="<%[ File Retention ]%>" SortExpression="fileretention">
                                <prop:ItemTemplate>
-                                       <%=(integer)($this->getParent()->Data['fileretention'] / 3600 / 24)%> <%=$this->getParent()->Data['fileretention'] < 172800 ? Prado::localize('day') : Prado::localize('days')%>
+                                       <div rel="<%=$this->getParent()->Data['fileretention']%>"><%=(integer)($this->getParent()->Data['fileretention'] / 3600 / 24)%> <%=$this->getParent()->Data['fileretention'] < 172800 ? Prado::localize('day') : Prado::localize('days')%></div>
                                </prop:ItemTemplate>
                        </com:TActiveTemplateColumn>
                        <com:TActiveTemplateColumn HeaderText="<%[ Job Retention ]%>" SortExpression="jobretention">
index 53c1fe5daa08ad4a78ea8ac95967b4394599c7ff..66956b43d4e18fa4aa5fe1ab46176892bb9cf6d9 100644 (file)
@@ -56,7 +56,7 @@
                </com:TActiveTemplateColumn>
                <com:TActiveTemplateColumn HeaderText="<%[ Size ]%>" SortExpression="jobbytes">
                        <prop:ItemTemplate>
-                               <div class="size"><%=$this->getParent()->Data['jobbytes']%></div>
+                               <div class="size" rel="<%=$this->getParent()->Data['jobbytes']%>"><%=$this->getParent()->Data['jobbytes']%></div>
                        </prop:ItemTemplate>
                </com:TActiveTemplateColumn>
                <com:TActiveBoundColumn SortExpression="jobfiles" HeaderText="<%[ Files ]%>" DataField="jobfiles" />
index d0193a144758209d6d789da43d50e3ad868d7b4c..12bf5fb83afee4190c8ae5ac71270f075637bca4 100644 (file)
@@ -36,7 +36,7 @@
                        />
                        <com:TActiveTemplateColumn HeaderText="Vol. retention" SortExpression="volretention">
                                <prop:ItemTemplate>
-                                       <%=(integer)($this->getParent()->Data['volretention'] / 3600 / 24)%> <%=$this->getParent()->Data['volretention'] < 172800 ? 'day' : 'days'%>
+                                       <div rel="<%=$this->getParent()->Data['volretention']%>"><%=(integer)($this->getParent()->Data['volretention'] / 3600 / 24)%> <%=$this->getParent()->Data['volretention'] < 172800 ? 'day' : 'days'%>
                                </prop:ItemTemplate>
                        </com:TActiveTemplateColumn>
                        <com:TActiveTemplateColumn HeaderText="AutoPrune" SortExpression="autoprune" ItemStyle.HorizontalAlign="Center">