Zolcsi
4 Sep 2009, 7:17 AM
Hi folks,
I needed some enhancements on the grouptabpanel, and I thought you might like it, so here they are:
First I created a very simple function:
collapseGroup: function(groupEl){
if(groupEl.isXType) {
groupEl = this.getGroupEl(groupEl);
}
Ext.fly(groupEl).removeClass('x-grouptabs-expanded');
this.syncTabJoint();
},
And then I needed to close the groups once "inactivated", so there is always just one group open. I made a new config option for that, called: allowMultipleGroupsOpen which has to be set to false
This is a new method again:
closeGroupIfInactive: function(currentItem){
if(currentItem.id != this.activeGroup.id)
{
this.collapseGroup(currentItem);
}
},
And some changes in the setActiveGroup method:
setActiveGroup : function(group) {
group = this.getComponent(group);
if(!group || this.fireEvent('beforegroupchange', this, group, this.activeGroup) === false){
return;
}
if(!this.rendered){
this.activeGroup = group;
return;
}
if(this.activeGroup != group){
if(this.activeGroup){
var oldEl = this.getGroupEl(this.activeGroup);
if(oldEl){
Ext.fly(oldEl).removeClass('x-grouptabs-strip-active');
}
this.activeGroup.fireEvent('deactivate', this.activeTab);
}
var groupEl = this.getGroupEl(group);
Ext.fly(groupEl).addClass('x-grouptabs-strip-active');
this.activeGroup = group;
this.stack.add(group);
this.layout.setActiveItem(group);
this.syncTabJoint(groupEl);
group.fireEvent('activate', group);
this.fireEvent('groupchange', this, group);
if(!Ext.isEmpty(this.allowMultipleGroupsOpen) && !this.allowMultipleGroupsOpen)
{
this.items.each(this.closeGroupIfInactive, this);
}
}
},
I hope you like this enhancements :)
Cheers
I needed some enhancements on the grouptabpanel, and I thought you might like it, so here they are:
First I created a very simple function:
collapseGroup: function(groupEl){
if(groupEl.isXType) {
groupEl = this.getGroupEl(groupEl);
}
Ext.fly(groupEl).removeClass('x-grouptabs-expanded');
this.syncTabJoint();
},
And then I needed to close the groups once "inactivated", so there is always just one group open. I made a new config option for that, called: allowMultipleGroupsOpen which has to be set to false
This is a new method again:
closeGroupIfInactive: function(currentItem){
if(currentItem.id != this.activeGroup.id)
{
this.collapseGroup(currentItem);
}
},
And some changes in the setActiveGroup method:
setActiveGroup : function(group) {
group = this.getComponent(group);
if(!group || this.fireEvent('beforegroupchange', this, group, this.activeGroup) === false){
return;
}
if(!this.rendered){
this.activeGroup = group;
return;
}
if(this.activeGroup != group){
if(this.activeGroup){
var oldEl = this.getGroupEl(this.activeGroup);
if(oldEl){
Ext.fly(oldEl).removeClass('x-grouptabs-strip-active');
}
this.activeGroup.fireEvent('deactivate', this.activeTab);
}
var groupEl = this.getGroupEl(group);
Ext.fly(groupEl).addClass('x-grouptabs-strip-active');
this.activeGroup = group;
this.stack.add(group);
this.layout.setActiveItem(group);
this.syncTabJoint(groupEl);
group.fireEvent('activate', group);
this.fireEvent('groupchange', this, group);
if(!Ext.isEmpty(this.allowMultipleGroupsOpen) && !this.allowMultipleGroupsOpen)
{
this.items.each(this.closeGroupIfInactive, this);
}
}
},
I hope you like this enhancements :)
Cheers