Roo/form/ComboBoxArray.js
[roojs1] / roojs-bootstrap-debug.js
index 323151a..5592037 100644 (file)
@@ -2970,12 +2970,22 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     
     sort : function(e,el)
     {
-        Roo.log(e);
-        Roo.log(el);
-        Roo.log(Roo.get(el));
-        //this.store.sortInfo = {field:'created_dt',direction:'DESC'};
+        var col = Roo.get(el)
+        
+        if(!col.hasClass('sortable')){
+            return;
+        }
+        
+        var sort = col.attr('sort');
+        var dir = 'ASC';
         
-        //this.store.load();
+        if(col.hasClass('glyphicon-arrow-up')){
+            dir = 'DESC';
+        }
+        
+        this.store.sortInfo = {field : sort, direction : dir};
+        
+        this.store.load();
     },
     
     renderHeader : function()
@@ -3004,6 +3014,10 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
                 c.cls = 'sortable';
             }
             
+            if(typeof(config.width) != 'undefined'){
+                c.style = 'width:' + config.width + 'px';
+            }
+            
             header.cn.push(c)
         }
         
@@ -3034,8 +3048,21 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     {
         Roo.log('ds onload');
         
+        var _this = this;
         var cm = this.cm;
         
+        Roo.each(this.el.select('thead th.sortable', true).elements, function(e){
+            e.removeClass(['glyphicon', 'glyphicon-arrow-up', 'glyphicon-arrow-down']);
+            
+            if(e.hasClass('sortable') && e.attr('sort') == _this.store.sortInfo.field && _this.store.sortInfo.direction.toUpperCase() == 'ASC'){
+                e.addClass(['glyphicon', 'glyphicon-arrow-up']);
+            }
+            
+            if(e.hasClass('sortable') && e.attr('sort') == _this.store.sortInfo.field && _this.store.sortInfo.direction.toUpperCase() == 'DESC'){
+                e.addClass(['glyphicon', 'glyphicon-arrow-down']);
+            }
+        });
+        
         var tbody = this.el.select('tbody', true).first();
         
         var renders = [];
@@ -3071,7 +3098,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
                     };
                     
                     if(typeof(config.width) != 'undefined'){
-                        td.width = config.width;
+                        td.style = 'width:' +  config.width + 'px';
                     }
                     
                     row.cn.push(td);