buildSDK/dependancy_bootstrap.txt
[roojs1] / roojs-bootstrap-debug.js
index 30c5202..770cb96 100644 (file)
@@ -1945,11 +1945,13 @@ Roo.extend(Roo.bootstrap.Navbar.Item, Roo.bootstrap.Component,  {
             e.preventDefault();
         }
         
+        if(this.fireEvent('click', this, e) === false){
+            return;
+        };
+        
         if (['tabs','pills'].indexOf(this.parent().type)!==-1) {
             this.onTabsClick(e);
         } 
-        
-        this.fireEvent('click', this, e);
     },
     
     onTabsClick : function(e)
@@ -2320,7 +2322,8 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         
         cfg = {
             tag: 'table',
-            cls : 'table'
+            cls : 'table',
+            cn : []
         }
             
         if (this.striped) {
@@ -2379,42 +2382,180 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
             cfg.width=this.width;
         }
         
-        if(this.store && this.cm && this.sm){
-            cfg.cn = this.initTableGrid();
+        if(this.store || this.cm){
+            cfg.cn.push(this.renderHeader());
+            cfg.cn.push(this.renderBody());
+            cfg.cn.push(this.renderFooter());
+            
+            cfg.cls+=  ' TableGrid';
         }
         
         return cfg;
     },
-    
-    initTableGrid : function()
-    {
-        var cfg = {};
-        
-//        cfg.push({
+//    
+//    initTableGrid : function()
+//    {
+//        var cfg = {};
+//        
+//        var header = {
 //            tag: 'thead',
-//            
-//        })
-    },
+//            cn : []
+//        };
+//        
+//        var cm = this.cm;
+//        
+//        for(var i = 0, len = cm.getColumnCount(); i < len; i++){
+//            header.cn.push({
+//                tag: 'th',
+//                html: cm.getColumnHeader(i)
+//            })
+//        }
+//        
+//        cfg.push(header);
+//        
+//        return cfg;
+//        
+//        
+//    },
     
     initEvents : function()
     {   
-        if(!this.store && !this.cm && !this.sm){
+        if(!this.store || !this.cm){
             return;
         }
         
-        Roo.log('initEvents!!!!');
-        Roo.log(this.sm);
+        Roo.log('initEvents with ds!!!!');
+        
+//        this.maskEl = Roo.DomHelper.append(this.el.select('.TableGrid', true).first(), {tag: "div", cls:"x-dlg-mask"}, true);
+//        this.maskEl.enableDisplayMode("block");
+//        this.maskEl.show();
+        
+        this.store.on('load', this.onLoad, this);
+        this.store.on('beforeload', this.onBeforeLoad, this);
+        
+        this.store.load();
+        
+        
+        
+    },
+    
+    renderHeader : function()
+    {
+        var header = {
+            tag: 'thead',
+            cn : []
+        };
         
         var cm = this.cm;
-        var colCount = cm.getColumnCount();
         
-        var header = this.renderHeaders();
+        for(var i = 0, len = cm.getColumnCount(); i < len; i++){
+            header.cn.push({
+                tag: 'th',
+                html: cm.getColumnHeader(i)
+            })
+        }
+        
+        return header;
+    },
+    
+    renderBody : function()
+    {
+        var body = {
+            tag: 'tbody',
+            cn : []
+        };
+        
+        return body;
+    },
+    
+    renderFooter : function()
+    {
+        var footer = {
+            tag: 'tfoot',
+            cn : []
+        };
+        
+        return footer;
+    },
+    
+    onLoad : function()
+    {
+        Roo.log('ds onload');
+        
+        var cm = this.cm;
+        
+        var tbody = this.el.select('tbody', true).first();
+        
+        var renders = [];
+        
+        if(this.store.getCount() > 0){
+            this.store.data.each(function(d){
+                var row = {
+                    tag : 'tr',
+                    cn : []
+                };
+                
+                for(var i = 0, len = cm.getColumnCount(); i < len; i++){
+                    var renderer = cm.getRenderer(i);
+                    var value = '';
+                    var id = Roo.id();
+                    
+                    if(typeof(renderer) !== 'undefined'){
+                        value = renderer(d.data[cm.getDataIndex(i)], false, d);
+                    }
+                    
+                    if(typeof(value) === 'object'){
+                        renders.push({
+                            id : id,
+                            cfg : value 
+                        })
+                    }
+                    
+                    row.cn.push({
+                        tag: 'td',
+                        id: id,
+                        html: (typeof(value) === 'object') ? '' : value
+                    })
+                   
+                }
+                
+                tbody.createChild(row);
+                
+            });
+        }
         
+        if(renders.length){
+            Roo.each(renders, function(r){
+                r.cfg.render(Roo.get(r.id));
+            })
+        }
+//        
+//        if(this.loadMask){
+//            this.maskEl.hide();
+//        }
     },
     
-    renderHeaders : function()
+    onBeforeLoad : function()
     {
+        Roo.log('ds onBeforeLoad');
+        
+        this.clear();
         
+//        if(this.loadMask){
+//            this.maskEl.show();
+//        }
+    },
+    
+    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;
     }
    
 });
@@ -7230,6 +7371,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
             this.pageTb = new Roo.Toolbar(this.footer);
            
         }
+        */
         if(this.pageSize){
             this.footer = this.list.createChild({cls:cls+'-ft'});
             this.pageTb = new Roo.PagingToolbar(this.footer, this.store,
@@ -7253,7 +7395,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
         if (this.footer) {
             this.assetHeight += this.footer.getHeight();
         }
-        */
+        
             
         if(!this.tpl){
             this.tpl = '<li><a href="#">{' + this.displayField + '}</a></li>';
@@ -8656,6 +8798,7 @@ Roo.bootstrap = Roo.bootstrap || {};
  * @class Roo.bootstrap.Calendar
  * @extends Roo.bootstrap.Component
  * Bootstrap Calendar class
+ * @cfg {Boolean} loadMask (true|false) default false
     
  * @constructor
  * Create a new Container
@@ -8714,6 +8857,8 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component,  {
      * Day index at which the week should begin, 0-based (defaults to 0, which is Sunday)
      */
     startDay : 0,
+    
+    loadMask : false,
       
     getAutoCreate : function(){
         
@@ -8921,12 +9066,40 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component,  {
             throw "can not find store for calendar";
         }
         
-        this.maskEl = Roo.DomHelper.append(this.el.select('.fc-content', true).first(), {tag: "div", cls:"x-dlg-mask"}, true);
+        var mark = {
+            tag: "div",
+            cls:"x-dlg-mask",
+            style: "text-align:center",
+            cn: [
+                {
+                    tag: "div",
+                    style: "background-color:white;width:50%;margin:250 auto",
+                    cn: [
+                        {
+                            tag: "img",
+                            src: rootURL + '/roojs1/images/ux/lightbox/loading.gif'
+                        },
+                        {
+                            tag: "span",
+                            html: "Loading"
+                        }
+                        
+                    ]
+                }
+            ]
+        }
+        this.maskEl = Roo.DomHelper.append(this.el.select('.fc-content', true).first(), mark, true);
+        
+        var size = this.el.select('.fc-content', true).first().getSize();
+        this.maskEl.setSize(size.width, size.height);
         this.maskEl.enableDisplayMode("block");
-        this.maskEl.hide();
+        if(!this.loadMask){
+            this.maskEl.hide();
+        }
         
         this.store = Roo.factory(this.store, Roo.data);
         this.store.on('load', this.onLoad, this);
+        this.store.on('beforeload', this.onBeforeLoad, this);
         
         this.resize();
         
@@ -8942,7 +9115,7 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component,  {
         
         this.on('monthchange', this.onMonthChange, this);
         
-        this.update(new Date().clearTime());
+//        this.update(new Date().clearTime());
     },
     
     resize : function() {
@@ -9368,11 +9541,7 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component,  {
     },
     
     onLoad: function () 
-    {
-        this.mask();
-        
-        this.clearEvents();
-
+    {   
         this.calevents = [];
         var cal = this;
         if(this.store.getCount() > 0){
@@ -9390,18 +9559,19 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component,  {
         }
         
         this.renderEvents();
+        
+        if(this.loadMask){
+            this.maskEl.hide();
+        }
     },
     
-    mask: function()
+    onBeforeLoad: function()
     {
-        var size = this.el.select('.fc-content', true).first().getViewSize();
-//        var xy = this.el.getXY();
-        
-        this.el.addClass("x-body-masked");
+        this.clearEvents();
         
-        this.maskEl.setSize(size.width, size.height);
-//        this.maskEl.setXY([0,0]);
-        this.maskEl.show();
+        if(this.loadMask){
+            this.maskEl.show();
+        }
     }
 });