Roo/bootstrap/Table.js
authorEdward <edward@roojs.com>
Mon, 12 May 2014 13:28:21 +0000 (21:28 +0800)
committerEdward <edward@roojs.com>
Mon, 12 May 2014 13:28:21 +0000 (21:28 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

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

index d4f5b79..86f36c8 100644 (file)
@@ -263,11 +263,13 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
                     }
                     Roo.log(value);
                     if(typeof(value) === 'object'){
+                        var td = {
+                            tag: 'td'
+                        }
                         
-                        row.cn.push({
-                            tag: 'td',
-                            cn: value
-                        })
+                        value.render(td);
+                        
+                        row.cn.push(td);
                     }else{
                         row.cn.push({
                             tag: 'td',
index bc85153..8afdf6d 100644 (file)
@@ -2502,11 +2502,13 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
                     }
                     Roo.log(value);
                     if(typeof(value) === 'object'){
+                        var td = {
+                            tag: 'td'
+                        }
                         
-                        row.cn.push({
-                            tag: 'td',
-                            cn: value
-                        })
+                        value.render(td);
+                        
+                        row.cn.push(td);
                     }else{
                         row.cn.push({
                             tag: 'td',
index 66cdb04..b99c6ca 100644 (file)
@@ -69,7 +69,8 @@ Roo.bootstrap.Slider=function(A){Roo.bootstrap.Slider.superclass.constructor.cal
 //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!!!!');this.store.on('load',this.onLoad,this);this.store.on('beforeload',this.onBeforeLoad,this);this.store.load();},renderHeader:function(){var A={tag:'thead',cn:[]};var cm=this.cm;for(var i=0,B=cm.getColumnCount();i<B;i++){A.cn.push({tag:'th',html:cm.getColumnHeader(i)})}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 cm=this.cm;var A=this.el.select('tbody',true).first();if(this.store.getCount()>0){this.store.data.each(function(d){var B={tag:'tr',cn:[]};for(var i=0,C=cm.getColumnCount();i<C;i++){var D=cm.getRenderer(i);var E='';if(typeof(D)!=='undefined'){E=D(d.data[cm.getDataIndex(i)],false,d);}
-Roo.log(E);if(typeof(E)==='object'){B.cn.push({tag:'td',cn:E})}else {B.cn.push({tag:'td',html:E})}}
+Roo.log(E);if(typeof(E)==='object'){var td={tag:'td'}
+E.render(td);B.cn.push(td);}else {B.cn.push({tag:'td',html:E})}}
 A.createChild(B);});}},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;}});
 //Roo/bootstrap/TableCell.js
 Roo.bootstrap.TableCell=function(A){Roo.bootstrap.TableCell.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.TableCell,Roo.bootstrap.Component,{html:false,cls:false,tag:false,abbr:false,align:false,axis:false,bgcolor:false,charoff:false,colspan:false,headers:false,height:false,nowrap:false,rowspan:false,scope:false,valign:false,width:false,getAutoCreate:function(){var A=Roo.apply({},Roo.bootstrap.TableCell.superclass.getAutoCreate.call(this));A={tag:'td'};if(this.tag){A.tag=this.tag;}if(this.html){A.html=this.html}if(this.cls){A.cls=this.cls}if(this.abbr){A.abbr=this.abbr}if(this.align){A.align=this.align}if(this.axis){A.axis=this.axis}if(this.bgcolor){A.bgcolor=this.bgcolor}if(this.charoff){A.charoff=this.charoff}if(this.colspan){A.colspan=this.colspan}if(this.headers){A.headers=this.headers}if(this.height){A.height=this.height}if(this.nowrap){A.nowrap=this.nowrap}if(this.rowspan){A.rowspan=this.rowspan}if(this.scope){A.scope=this.scope}if(this.valign){A.valign=this.valign}if(this.width){A.width=this.width}return A;}});