View Full Version : Grid Window Source

24 Nov 2007, 9:11 PM

Does anyone have the link for a grid window example. I've seen it in the web desktop demo but I would like to see the source code and learn how to create a grid window myself.

The reason why I want to have the grid within the window is because I would like to be able to drag and move the grid from within the browser. If there is a simple grid window example, please post it. Thanks!

24 Nov 2007, 9:37 PM
Its pretty straight forward with 2.x, just pass your grid to the windows 'items' config

your_grid = new Ext.grid.GridPanel({

your_window = new Ext.Window({
layout: 'fit',
items: your_grid

You will need the layout: 'fit' in the window config for this to work.

24 Nov 2007, 10:47 PM
I see. So I started testing my code and I noticed that I can only select one row at a time. :-? I'm not sure why that is. The code is very similar to the examples too. Did I miss something?

items: new Ext.grid.GridPanel({
ds: new Ext.data.Store({
reader: new Ext.data.ArrayReader({}, [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
data: Ext.grid.dummyData
cm: new Ext.grid.ColumnModel([
new Ext.grid.CheckboxSelectionModel(),
{id:'company',header: "Company", width: 120, sortable: true, dataIndex: 'company'},
{header: "Price", width: 70, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
{header: "Change", width: 70, sortable: true, dataIndex: 'change'},
{header: "% Change", width: 70, sortable: true, dataIndex: 'pctChange'},
{header: "Last Updated", width: 95, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
sm: new Ext.grid.CheckboxSelectionModel(),
viewConfig: {

25 Nov 2007, 8:16 PM
When I use the checkbox selection model, I declare it first, then pass that variable to my grid and column model, the same way the examples do it (examples/grid/grid3.js)...

var sm = new Ext.grid.CheckboxSelectionModel();

Not sure if thats the problem, but give it a try.

Also, it seems like you might have some syntax errors in the code you posted, an extra curly bracket in there. Are you using FireBug to debug your code?