toaster: edit column list not sorted

Submitted by Reyna, David on Sept. 3, 2017, 8:15 p.m. | Patch ID: 143606

Details

Message ID 1504469754-11556-1-git-send-email-david.reyna@windriver.com
State Superseded
Headers show

Commit Message

Reyna, David Sept. 3, 2017, 8:15 p.m.
From: David Reyna <David.Reyna@windriver.com>

The list of columns in the many 'Edit Columns' pop-ups became unsorted
with the 'Toaster Table' implementation. These entries need to be
gathered and sorted in the column processing.

[YOCTO #12004]

Signed-off-by: David Reyna <David.Reyna@windriver.com>
---
 bitbake/lib/toaster/toastergui/static/js/table.js | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/bitbake/lib/toaster/toastergui/static/js/table.js b/bitbake/lib/toaster/toastergui/static/js/table.js
index 1bbc8d1..7e7569b 100644
--- a/bitbake/lib/toaster/toastergui/static/js/table.js
+++ b/bitbake/lib/toaster/toastergui/static/js/table.js
@@ -202,6 +202,7 @@  function tableInit(ctx){
     }
 
     /* Add table header and column toggle menu */
+    var column_edit_entries = [];
     for (var i in tableData.columns){
       var col = tableData.columns[i];
       if (col.displayable === false) {
@@ -293,12 +294,28 @@  function tableInit(ctx){
         defaultHiddenCols.push(col.field_name);
       }
 
-      editColMenu.append(toggler);
+      /* Gather the Edit Column entries */
+      column_edit_entries.push({'title':col.title,'html':toggler});
+
     } /* End for each column */
 
+    /* Append the sorted Edit Columns toggler entries */
+    column_edit_entries.sort(function(a,b) {return (a.title > b.title) ? 1 : ((b.title > a.title) ? -1 : 0);} ); 
+    for (var col in column_edit_entries){
+      editColMenu.append(column_edit_entries[col].html);
+    }
+
     tableChromeDone = true;
   }
 
+  function col_compare(a,b) {
+    if (a.last_nom < b.last_nom)
+      return -1;
+    if (a.last_nom > b.last_nom)
+      return 1;
+    return 0;
+  }
+
   /* Toggles the active state of the filter button */
   function filterBtnActive(filterBtn, active){
     if (active) {

Comments

Reyna, David Sept. 4, 2017, 6:27 a.m.
This is a system generated Comment: Patch 143606 was automatically marked as superseded by patch 143607.