Roo/bootstrap/Table.js
authorEdward <edward@roojs.com>
Fri, 11 Jul 2014 10:06:51 +0000 (18:06 +0800)
committerEdward <edward@roojs.com>
Fri, 11 Jul 2014 10:06:51 +0000 (18:06 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/Table.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 75dd6bd..cc25b4d 100644 (file)
@@ -216,7 +216,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         var sort = col.attr('sort');
         var dir = 'ASC';
         
-        if(col.hasClass('icon-arrow-up')){
+        if(col.hasClass('glyphicon-arrow-up')){
             dir = 'DESC';
         }
         
@@ -289,14 +289,14 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         var cm = this.cm;
         
         Roo.each(this.el.select('thead th.sortable', true).elements, function(e){
-            e.removeClass(['icon-arrow-up', 'icon-arrow-down']);
+            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('icon-arrow-up');
+                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('icon-arrow-down');
+                e.addClass(['glyphicon', 'glyphicon-arrow-down']);
             }
         });
         
index 709d875..5592037 100644 (file)
@@ -2979,7 +2979,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         var sort = col.attr('sort');
         var dir = 'ASC';
         
-        if(col.hasClass('icon-arrow-up')){
+        if(col.hasClass('glyphicon-arrow-up')){
             dir = 'DESC';
         }
         
@@ -3052,14 +3052,14 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         var cm = this.cm;
         
         Roo.each(this.el.select('thead th.sortable', true).elements, function(e){
-            e.removeClass(['icon-arrow-up', 'icon-arrow-down']);
+            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('icon-arrow-up');
+                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('icon-arrow-down');
+                e.addClass(['glyphicon', 'glyphicon-arrow-down']);
             }
         });
         
index 3089590..68e2aa1 100644 (file)
@@ -78,9 +78,9 @@ this.fireEvent('click',this,e);}});
 Roo.bootstrap.Slider=function(A){Roo.bootstrap.Slider.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Slider,Roo.bootstrap.Component,{getAutoCreate:function(){var A={tag:'div',cls:'slider slider-sample1 vertical-handler ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all',cn:[{tag:'a',cls:'ui-slider-handle ui-state-default ui-corner-all'}]};return A;}});
 //Roo/bootstrap/Table.js
 Roo.bootstrap.Table=function(A){Roo.bootstrap.Table.superclass.constructor.call(this,A);if(this.sm){this.selModel=Roo.factory(this.sm,Roo.bootstrap.Table);this.sm=this.selModel;this.sm.xmodule=this.xmodule||false;}if(this.cm&&typeof(this.cm.config)=='undefined'){this.colModel=new Roo.bootstrap.Table.ColumnModel(this.cm);this.cm=this.colModel;this.cm.xmodule=this.xmodule||false;}if(this.store){this.store=Roo.factory(this.store,Roo.data);this.ds=this.store;this.ds.xmodule=this.xmodule||false;}};Roo.extend(Roo.bootstrap.Table,Roo.bootstrap.Component,{cls:false,align:false,bgcolor:false,border:false,cellpadding:false,cellspacing:false,frame:false,rules:false,sortable:false,summary:false,width:false,striped:false,bordered:false,hover:false,condensed:false,responsive:false,sm:false,cm:false,store:false,getAutoCreate:function(){var A=Roo.apply({},Roo.bootstrap.Table.superclass.getAutoCreate.call(this));A={tag:'table',cls:'table',cn:[]};if(this.striped){A.cls+=' table-striped';}if(this.hover){A.cls+=' table-hover';}if(this.bordered){A.cls+=' table-bordered';}if(this.condensed){A.cls+=' table-condensed';}if(this.responsive){A.cls+=' table-responsive';}if(this.cls){A.cls+=' '+this.cls;}if(this.align){A.align=this.align;}if(this.bgcolor){A.bgcolor=this.bgcolor;}if(this.border){A.border=this.border;}if(this.cellpadding){A.cellpadding=this.cellpadding;}if(this.cellspacing){A.cellspacing=this.cellspacing;}if(this.frame){A.frame=this.frame;}if(this.rules){A.rules=this.rules;}if(this.sortable){A.sortable=this.sortable;}if(this.summary){A.summary=this.summary;}if(this.width){A.width=this.width;}if(this.store||this.cm){A.cn.push(this.renderHeader());A.cn.push(this.renderBody());A.cn.push(this.renderFooter());A.cls+=' TableGrid';}return A;},initEvents:function(){if(!this.store||!this.cm){return;}
-Roo.log('initEvents with ds!!!!');var A=this;Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.on('click',A.sort,A);});this.store.on('load',this.onLoad,this);this.store.on('beforeload',this.onBeforeLoad,this);this.store.load();},sort:function(e,el){var A=Roo.get(el)if(!A.hasClass('sortable')){return;}var sort=A.attr('sort');var B='ASC';if(A.hasClass('icon-arrow-up')){B='DESC';}
+Roo.log('initEvents with ds!!!!');var A=this;Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.on('click',A.sort,A);});this.store.on('load',this.onLoad,this);this.store.on('beforeload',this.onBeforeLoad,this);this.store.load();},sort:function(e,el){var A=Roo.get(el)if(!A.hasClass('sortable')){return;}var sort=A.attr('sort');var B='ASC';if(A.hasClass('glyphicon-arrow-up')){B='DESC';}
 this.store.sortInfo={field:sort,direction:B};this.store.load();},renderHeader:function(){var A={tag:'thead',cn:[]};var cm=this.cm;for(var i=0,B=cm.getColumnCount();i<B;i++){var C=cm.config[i];var c={tag:'th',html:cm.getColumnHeader(i)};if(typeof(C.dataIndex)!='undefined'){c.sort=C.dataIndex;}if(typeof(C.sortable)!='undefined'&&C.sortable){c.cls='sortable';}if(typeof(C.width)!='undefined'){c.style='width:'+C.width+'px';}
-A.cn.push(c)}return A;},renderBody:function(){var A={tag:'tbody',cn:[]};return A;},renderFooter:function(){var A={tag:'tfoot',cn:[]};return A;},onLoad:function(){Roo.log('ds onload');var A=this;var cm=this.cm;Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.removeClass(['icon-arrow-up','icon-arrow-down']);if(e.hasClass('sortable')&&e.attr('sort')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='ASC'){e.addClass('icon-arrow-up');}if(e.hasClass('sortable')&&e.attr('sort')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='DESC'){e.addClass('icon-arrow-down');}});var B=this.el.select('tbody',true).first();var C=[];if(this.store.getCount()>0){this.store.data.each(function(d){var D={tag:'tr',cn:[]};for(var i=0,E=cm.getColumnCount();i<E;i++){var F=cm.getRenderer(i);var G=cm.config[i];var H='';var id=Roo.id();if(typeof(F)!=='undefined'){H=F(d.data[cm.getDataIndex(i)],false,d);}if(typeof(H)==='object'){C.push({id:id,cfg:H})}var td={tag:'td',id:id,html:(typeof(H)==='object')?'':H};if(typeof(G.width)!='undefined'){td.style='width:'+G.width+'px';}
+A.cn.push(c)}return A;},renderBody:function(){var A={tag:'tbody',cn:[]};return A;},renderFooter:function(){var A={tag:'tfoot',cn:[]};return A;},onLoad:function(){Roo.log('ds onload');var A=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')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='ASC'){e.addClass(['glyphicon','glyphicon-arrow-up']);}if(e.hasClass('sortable')&&e.attr('sort')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='DESC'){e.addClass(['glyphicon','glyphicon-arrow-down']);}});var B=this.el.select('tbody',true).first();var C=[];if(this.store.getCount()>0){this.store.data.each(function(d){var D={tag:'tr',cn:[]};for(var i=0,E=cm.getColumnCount();i<E;i++){var F=cm.getRenderer(i);var G=cm.config[i];var H='';var id=Roo.id();if(typeof(F)!=='undefined'){H=F(d.data[cm.getDataIndex(i)],false,d);}if(typeof(H)==='object'){C.push({id:id,cfg:H})}var td={tag:'td',id:id,html:(typeof(H)==='object')?'':H};if(typeof(G.width)!='undefined'){td.style='width:'+G.width+'px';}
 D.cn.push(td);}
 B.createChild(D);});}if(C.length){var A=this;Roo.each(C,function(r){A.renderColumn(r);})}},onBeforeLoad:function(){Roo.log('ds onBeforeLoad');this.clear();},clear:function(){this.el.select('tbody',true).first().dom.innerHTML='';},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.bootstrap.Table.RowSelectionModel();}return this.selModel;},renderColumn:function(r){var A=this;r.cfg.render(Roo.get(r.id));if(r.cfg.cn){Roo.each(r.cfg.cn,function(c){var B={id:r.id,cfg:c}
 A.renderColumn(B);})}}});