[bitbake-devel] [PATCH 3/3] toaster: edit column list not sorted

David Reyna david.reyna at windriver.com
Mon Sep 4 04:02:23 UTC 2017


From: David Reyna <David.Reyna at 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 at windriver.com>
---
 lib/toaster/toastergui/static/js/table.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/toaster/toastergui/static/js/table.js b/lib/toaster/toastergui/static/js/table.js
index 1bbc8d1..abcb5ca 100644
--- a/lib/toaster/toastergui/static/js/table.js
+++ b/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,9 +294,17 @@ 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 Column 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;
   }
 
-- 
1.9.1




More information about the bitbake-devel mailing list