PDA

View Full Version : Adding a grid in a tabpanel



gma990
19 May 2009, 6:42 AM
Hello,

I'm trying to put a gridpanel in a tabpanel but the result is a blank page. I just can't see what's wrong in my code. Your help will be appreciated.


Ext.onReady(function(){;

Ext.SSL_SECURE_URL="images/default/s.gif";
Ext.BLANK_IMAGE_URL="images/default/s.gif";
Ext.QuickTips.init();

var tickets = new Ext.data.Store({
data: [
[0,'09051510401', 'MDME104', 'Mail', 'Expunge'],
[1,'09051510402', 'JCDH104', 'Internet', 'Site bloqué'],
[2,'09051402901', 'ASA029', 'Bureautique', 'Excel'],
[3,'09051410401', 'JCDH104', 'Mail', 'Expunge']
],
reader: new Ext.data.ArrayReader({id:'id'}, [
'id',
'ticket_id',
'ticket_user',
'ticket_categorie',
'ticket_sscategorie'
])
});

var test = new Ext.TabPanel({
activeTab: 0,
renderTo: 'divtab',
width: 500,
height: 350,
items: [{
title: 'Tickets',
xtype: 'gridpanel',
store: tickets,
columns: [
{header: 'Ticket', dataIndex: 'ticket_id'},
{header: 'Utilisateur', dataIndex: 'ticket_user'},
{header: 'Catégorie', dataIndex: 'ticket_categorie'},
{header: 'Sous-Catégorie', dataIndex: 'ticket_sscategorie'}
]
}]
});

});


Thanks in advance,
Geoffroy

Animal
19 May 2009, 6:59 AM
id: 'id'?

So the name of a property in the row from which to draw the Record's ID is 'id'??

Anyway. Have you debugged?

Checked for loadexception events?

Stepped through and checked the count of records in the Store?

Animal
19 May 2009, 7:01 AM
Well, doing a bit of debugging for you, the Store loads OK.

Is there a div called 'divtab'?

Animal
19 May 2009, 7:02 AM
yer xtype is wrong!

gma990
19 May 2009, 7:15 AM
Yes, you're right. xytpe: 'grid' works fine!. Thanks

I'm newbie in ExtJs and I'm learning it with "Learning ExtJS".
In an example, they used 'xtype: 'gridpanel'.

Anyway. Thanks again for your quick support.