PDA

View Full Version : How Can I set active tabpanel?



elnaz
23 Aug 2011, 1:11 AM
Hi,

I have a tab with 3 tab and inside of each tab there is a grid list
I can delete row but ,I want to delete the row in active tab ,not if I have choose some row in another tab

How can I set active tab panel

Button code:


deleteList: function (button) {
var grids = button.up('relationspanel').query("gridpanel");
Ext.each(grids, function (grid) {
grid.store.remove(grid.getSelectionModel().getSelection());
});
}



Tab panel code:



extend: 'Ext.tab.Panel',
alias: 'widget.relationspanel',


width: 350,
border: true,
maxHeight: 280,
bodyBorder: false,
fieldDefaults: {
labelWidth: 75,
msgTarget: 'side'
},


constructor: function () {
this.callParent(arguments);
return this;
},


initComponent: function () {


this.items = [{
title: 'Credential',
xtype: 'container',
items: [{
align: 'center',
xtype: 'gridpanel',
store: 'StoreAuthentications',
selType: 'checkboxmodel',
multiSelect: true,
id: 'tab1',
columns: [{
header: 'Private User ID',
dataIndex: 'privUID',
flex: 1,
align: 'center'
}, {
header: 'Authentication Schema',
dataIndex: 'authSchema',
flex: 1,
align: 'center'
}, {


header: 'Authentication Data',
dataIndex: 'authData',
flex: 1,
align: 'center'
}, {


header: 'Public User ID',
dataIndex: 'puserid',
flex: 1,
align: 'center'
}]
}]


}, {
title: 'PublicUID',
xtype: 'container',
items: [{
align: 'center',
xtype: 'gridpanel',
store: 'StoreActivities',
selType: 'checkboxmodel',
id: 'tab2',
multiSelect: true,
columns: [{
header: 'Public User ID',
dataIndex: 'id',
flex: 1,
align: 'center'
}, {
header: 'Status',
dataIndex: 'status',
flex: 1,
align: 'center'
}, {
header: 'Online Status',
dataIndex: 'online',
flex: 1,
align: 'center'
}, {
header: 'Profile IDs',
dataIndex: 'profileIDs',
flex: 1,
align: 'center'
}


]
}]
}, {
title: 'Profile',
xtype: 'container',
items: [{
align: 'center',
xtype: 'gridpanel',
store: 'StoreProfile',
selType: 'checkboxmodel',
id: 'tab3',
multiSelect: true,
columns: [{
header: 'Profile ID',
dataIndex: 'id',
flex: 1,
align: 'center'
}, {
header: 'Profile Type',
dataIndex: 'type',
flex: 1,
align: 'center'
}, {
header: 'Profile Data',
dataIndex: 'data',
flex: 1,
align: 'center'
}, {
header: 'Private User IDs',
dataIndex: 'privUIDs',
flex: 1,
align: 'center'
}]
}]
}];


this.buttons = [{
text: 'Delete',
icon: '../../../images/DeleteUser.png',
action: 'delete',
scope: this,
id: 'list-delete'


}];


this.callParent(arguments);
}


});

skirtle
23 Aug 2011, 2:21 AM
I'm not sure I've understood correctly. Do you mean you want to delete the selected row from the currently active tab?

Like this perhaps?


deleteList: function (button) {
var grid = button.up('relationspanel').getActiveTab().query("gridpanel")[0];
grid.store.remove(grid.getSelectionModel().getSelection());
}

jay@moduscreate.com
24 Aug 2011, 5:18 AM
have you tried myPanelRef.tab.show()?

elnaz
25 Aug 2011, 1:07 AM
Thank you

elnaz
25 Aug 2011, 1:08 AM
Not yet,I will try it, thanks

It worked with getActiveTab()