return cfg;
},
- initEvents: function() {
- // Roo.log('init events?');
- // Roo.log(this.el.dom);
+ initEvents: function()
+ {
if (typeof (this.menu) != 'undefined') {
this.menu.parentType = this.xtype;
this.menu.triggerEl = this.el;
this.addxtype(Roo.apply({}, this.menu));
}
-
-
+
this.el.select('a',true).on('click', this.onClick, this);
+
+ if(this.tagtype == 'span'){
+ this.el.select('span',true).on('click', this.onClick, this);
+ }
+
// at this point parent should be available..
this.parent().register(this);
},
if(this.fireEvent('click', this, e) === false){
return;
};
+
+ if(this.tagtype == 'span'){
+ return;
+ }
+
var p = this.parent();
if (['tabs','pills'].indexOf(p.type)!==-1) {
if (typeof(p.setActiveItem) !== 'undefined') {
return value;
}
var v = Date.parseDate(value, this.format);
- if (!v && this.useIso) {
+ if (!v && (this.useIso || value.match(/^(\d{4})-0?(\d+)-0?(\d+)/))) {
v = Date.parseDate(value, 'Y-m-d');
}
if(!v && this.altFormats){
setValue: function(v)
{
- var d = new Date(v).clearTime();
+ // v can be a string or a date..
+
+
+ var d = new Date(this.parseDate(v) ).clearTime();
+
+ Roo.log(d);
+ Roo.log(d);
if(isNaN(d.getTime())){
this.date = this.viewDate = '';
Roo.bootstrap.DateField.superclass.setValue.call(this, '');
var nodeName = target.nodeName;
var className = target.className;
var html = target.innerHTML;
+ //Roo.log(nodeName);
switch(nodeName.toLowerCase()) {
case 'th':
}
break;
case 'span':
- if (className.indexOf('disabled') === -1) {
+ if (className.indexOf('disabled') < 0) {
this.viewDate.setUTCDate(1);
- if (className.indexOf('month') !== -1) {
+ if (className.indexOf('month') > -1) {
this.viewDate.setUTCMonth(Roo.bootstrap.DateField.dates[this.language].monthsShort.indexOf(html));
} else {
var year = parseInt(html, 10) || 0;
break;
case 'td':
- if (className.indexOf('day') !== -1 && className.indexOf('disabled') === -1){
+ //Roo.log(className);
+ if (className.indexOf('day') > -1 && className.indexOf('disabled') < 0 ){
var day = parseInt(html, 10) || 1;
var year = this.viewDate.getUTCFullYear(),
month = this.viewDate.getUTCMonth();
- if (className.indexOf('old') !== -1) {
+ if (className.indexOf('old') > -1) {
if(month === 0 ){
month = 11;
year -= 1;
}else{
month -= 1;
}
- } else if (className.indexOf('new') !== -1) {
+ } else if (className.indexOf('new') > -1) {
if (month == 11) {
month = 0;
year += 1;
month += 1;
}
}
+ //Roo.log([year,month,day]);
this.date = this.UTCDate(year, month, day,0,0,0,0);
this.viewDate = this.UTCDate(year, month, Math.min(28, day),0,0,0,0);
// this.fill();
+ //Roo.log(this.formatDate(this.date));
this.setValue(this.formatDate(this.date));
this.hide();
}
* @cfg {String} title Title of the TabBox
* @cfg {String} icon Icon of the TabBox
* @cfg {Boolean} showtabs (true|false) show the tabs default true
+ * @cfg {Boolean} tabScrollable (true|false) tab scrollable when mobile view default false
*
* @constructor
* Create a new TabBox
});
+
+ this.panes = [];
};
Roo.extend(Roo.bootstrap.dash.TabBox, Roo.bootstrap.Component, {
title : '',
icon : false,
showtabs : true,
+ tabScrollable : false,
getChildContainer : function()
{
});
}
+ var h = {
+ tag: 'ul',
+ cls: 'nav nav-tabs pull-right',
+ cn: [
+ header
+ ]
+ };
+
+ if(this.tabScrollable){
+ h = {
+ tag: 'div',
+ cls: 'tab-header',
+ cn: [
+ {
+ tag: 'ul',
+ cls: 'nav nav-tabs pull-right',
+ cn: [
+ header
+ ]
+ }
+ ]
+ }
+ }
var cfg = {
tag: 'div',
cls: 'nav-tabs-custom',
cn: [
- {
- tag: 'ul',
- cls: 'nav nav-tabs pull-right',
- cn: [
- header
- ]
- },
+ h,
{
tag: 'div',
cls: 'tab-content no-padding',
},
onAddPane : function(pane)
{
+ this.panes.push(pane);
//Roo.log('addpane');
//Roo.log(pane);
// tabs are rendere left to right..
pane.fireEvent('activate');
+ },
+
+ getActivePane : function()
+ {
+ var r = false;
+ Roo.each(this.panes, function(p) {
+ if(p.el.hasClass('active')){
+ r = p;
+ return false;
+ }
+
+ return;
+ });
+
+ return r;
}