PDA

View Full Version : Grid + Tabpanel with Editarea



metan
1 Mar 2011, 11:53 AM
Hi,

I have a TabPanel with 2 tabs. One with a grid and the other will be loaded by autoload with a HTML-form.
The situation is now, that if I click on the grid I'am getting the right Id of the grid and also the switch to the other tab works, but I can not pass the ID of the selected grid element to the form.



var subTabsEditView;
Ext.onReady(function(){

Ext.QuickTips.init();

subTabsEditView = new Ext.TabPanel({
renderTo: 'subTabsEditView',
autoWidth: true,
activeTab: 0,
plain: true,
hideBorders: true,
border: false,
frame: false,
defaults: {
autoHeight: true
},
items: [
{
contentEl:'idEditListViewTab',
title: 'Auflisten'
},

{
contentEl:'idEditInsertViewTab',
title: 'Neue Eintragen',
autoLoad: {
url: 'index.php',
params: 'eID=editView&var=reports&view=insertNew' ,
method: 'POST'
}

}
]
});


var records = Ext.data.Record.create([
{
name: 'title'
},
{
name: 'category'
},
{
name: 'date',
type: 'date',
dateFormat: 'timestamp'
},
{
name: 'uid',
type: 'int'
}
]);

var proxy = new Ext.data.HttpProxy({
url: "index.php?eID=editView&var=reports",
method: 'POST'
});
var store = new Ext.data.Store({
proxy: proxy,
autoLoad: true,
reader: new Ext.data.JsonReader({
root: 'data',
idProperty: 'id'
}, records)
});

// create the Grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{
id:'title',
header: "Titel",
width: 250,
sortable: true,
dataIndex: 'title'
},

{
header: "Kategory",
width: 150,
sortable: true,
dataIndex: 'category'
},

{
header: "Datum",
width: 75,
sortable: true,
dataIndex: 'date',
renderer: Ext.util.Format.dateRenderer('d M Y')
},

{
header: "Aktion",
xtype: 'actioncolumn',
sortable: false,
width: 50,
items: [{
icon : 'fileadmin/images/pageImages/editIcon.png', // Use a URL in the icon config
tooltip: 'Bearbeiten...',
handler: function(grid, rowIndex, colIndex) {
var rec = store.getAt(rowIndex);
//alert("Edit it: " + rec.get('title') + ' ' + rec.data['uid']);
subTabsEditView.setActiveTab(1);
}
}]
}
],

stripeRows: true,
autoScroll: true,
autoExpandColumn: 'title',
autoHeight: true,
autoWidth: true,
frame: false,
bbar: new Ext.PagingToolbar({
pageSize: 15,
store: store,
displayInfo: true,
displayMsg: '{0} - {1} von {2}',
emptyMsg: "Keine Einträge vorhanden"
})
});

grid.render('idEditGridView');
store.load({
params:{
start:0,
limit:15
}
});

});How can pass the selected gird number to the tab.

Thanks in advance.
metan

metan
2 Mar 2011, 1:37 AM
does someone has any idea.

Thanks in advance.
metan