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)
cfg = {
tag: 'table',
- cls : 'table'
+ cls : 'table',
+ cn : []
}
if (this.striped) {
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;
}
});
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,
if (this.footer) {
this.assetHeight += this.footer.getHeight();
}
- */
+
if(!this.tpl){
this.tpl = '<li><a href="#">{' + this.displayField + '}</a></li>';
* @class Roo.bootstrap.Calendar
* @extends Roo.bootstrap.Component
* Bootstrap Calendar class
+ * @cfg {Boolean} loadMask (true|false) default false
* @constructor
* Create a new Container
* Day index at which the week should begin, 0-based (defaults to 0, which is Sunday)
*/
startDay : 0,
+
+ loadMask : false,
getAutoCreate : function(){
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();
this.on('monthchange', this.onMonthChange, this);
- this.update(new Date().clearTime());
+// this.update(new Date().clearTime());
},
resize : function() {
},
onLoad: function ()
- {
- this.mask();
-
- this.clearEvents();
-
+ {
this.calevents = [];
var cal = this;
if(this.store.getCount() > 0){
}
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();
+ }
}
});