PDA

View Full Version : Adding Items to Ext.Panels



scblue
11 Jan 2010, 12:30 AM
Hi,

If I have these components in my codes:



var gridForm = new Ext.FormPanel({
-some codes-
});

var wgrid = new Ext.grid.EditorGridPanel({
-some codes-
});

var wgridpanel = new Ext.Panel({
id: 'wgridpanel',
height: 1000,
layout: 'form',
items: wgrid
});
When the codes runs, can I do this? --> :




wgridpanel.add(gridForm);
wgridpanel.doLayout();

Basically what I wanted to do was to have a grid, and when a row is clicked, another grid + a form will be displayed below the original grid.

I can add to the 'wgrid' which is the EditorGridPanel but I can't seem to add to wgridpanel.

I'd like to know if it's do-able, or am I just missing something here?

Thanks in advance!

Animal
11 Jan 2010, 12:34 AM
http://www.extjs.com/deploy/dev/docs/?class=Ext.Panel&member=layout

scblue
11 Jan 2010, 12:49 AM
Thanks Animal.
I was reading through that.
They're included in the subclasses, that meant I should be able to add them to the Panel right?
I must be missing something then.

Animal
11 Jan 2010, 12:50 AM
Are you writing an application?

scblue
11 Jan 2010, 12:58 AM
Yes, actually I am.
This particular module lets the user select a project from a grid. The categories relevant to the project will then be displayed in the bottom grid. User can then click again on a category and the information will be displayed in a form at the right hand side of the column, so the user can do some editing.

Animal
11 Jan 2010, 1:35 AM
Well don't!

If you are unsure how to do the coding, but dive straight into writing an application, it will end up having to be rewritten which will be very expensive.

Write a test page in which you experiment with adding Components to Containers with various layouts.

Do this until you have a handle on it, and then write an application.