PDA

View Full Version : Question on DataGrid in bordered layout



Westside
1 Nov 2009, 9:14 PM
Hi,

I'm still new to extjs and had a quick question. I have this code snippet, how can I insert a datagrid inside the center region of my layoutl? I think I'm having syntax issues. I have the xtype as grid, but the items property is not setup right obviously...

,{
region: 'center',
xtype: 'grid',
items: [{
title: 'Test Grid',
html: 'Center'
}]
}

Thanks..

-ws

evant
1 Nov 2009, 9:16 PM
The grid doesn't have any child items:



{
region: 'center',
xtype: 'grid',
store: //.....
}

Westside
1 Nov 2009, 9:46 PM
Thanks, that worked. I initially had created my datagrid but didn't render it, I was trying to find out if I could do something like:

var store = new Ext.data.Store({
....etc, etc
});

var MySalesGrid = new Ext.grid.GridPanel({
title: 'Movie Database',
store: store,
columns: [
{header: "Title", dataIndex: 'title'},
{header: "Director", dataIndex: 'director'},
{header: "Released", dataIndex: 'released',
renderer: Ext.util.Format.dateRenderer('m/d/Y')},
{header: "Genre", dataIndex: 'genre'},
{header: "Tagline", dataIndex: 'tagline'}
]
});

Then in my bordered layout:

region: 'center',
grid: MySalesGrid


Is that possible? I know there isn't a grid property, but if I've created my grid already, is there a way to just load the center region with the grid as opposed to defining the xtype, store within.... the end result would be the same, I'm just wondering is there a property or way of doing it that way...

hope that makes sense..

Thanks for the help..

-Westside

Animal
2 Nov 2009, 12:39 AM
Doesn't make much sense really.

What's wrong with just using the grid as the center region?