Here's my current code. I've included the section in it's entirety this time. Thank you again for looking at this. P.S. The variables that start with Zen. are visible throughout this section of code. That's why they can be referenced in several different scopes.
Again, the issue is getting the account information to replace the "myComponent" panel with the "accountPanel", and making the accountPanel information visible.
Code:
//----------------------------------------------------------
function AccountsListAdminUserPanelCreate(config)
{
Zen.AccountsListAdmin.Grid = AccountsListAdminGridCreate({
searchItemName: 'Email'
});
Zen.AccountsListAdmin.Grid.load(); //Creates a grid of accounts. (This method is not included)
CreateAccountsListAdminTabPanel(); //Creates a panel to display information about a selected account.
var items = [];
items.push ( Zen.AccountsListAdmin.Grid);
items.push( Zen.AccountsListAdmin.TabPanel);
//The Grid and the TabPanel are added to a Panel.
//The Grid shows account information. When a user clicks on an account,
//The TabPanel should show results about the selected account.
Zen.AccountsListAdmin.accountsListAdminPanel = new Ext.Panel({
layout: 'border',
baseCls: 'zen-account-panel',
title: 'Accounts',
hideMode: 'offsets',
items: items
});
return Zen.AccountsListAdmin.accountsListAdminPanel;
}
//-----------------------------------------------------------------------------
function CreateAccountsListAdminTabPanel(accountPanel)
{
var myComponent = new Ext.Panel({html: 'Select an account from the List above.'});
Zen.AccountsListAdmin.TabPanel = new Ext.Panel({
cls: 'zen-transparent-panel',
id: 'mainTabPanel',
border: false,
region: 'center',
activeTab: 0,
items: myComponent
});
if(Zen.AccountsListAdmin.accountsListAdminPanel)
{
//accountPanel is true when a user clicks on an account in the Zen.AccountsListAdmin.Grid
if(accountPanel)
{
Zen.AccountsListAdmin.accountsListAdminPanel.remove(Zen.AccountsListAdmin.TabPanel);
Zen.AccountsListAdmin.accountsListAdminPanel.add(accountPanel);
Zen.AccountsListAdmin.accountsListAdminPanel.doLayout();
}
}
}
//-----------------------------------------------------------------------------
//Creates the Grid of accounts
function AccountsListAdminGridCreate(config)
{
// Necessary defaults.
if (!config)
config = {};
if (config.clickable == null)
config.clickable = true;
//Needed config settings for split screen display.
config.collectionID = Zen.Constants.MasterTopics.Accounts;
config.border = false;
config.region = 'north';
config.split = true;
var viewGrid = new Zen.CollectionPanel(config);
viewGrid.height = 225;
viewGrid.hideMode = 'offsets';
viewGrid.on('gridrowclick', AccountsListAdminGridRowClick);
return viewGrid;
}
//-----------------------------------------------------------------------------
//This function populates a Panel with the selected accounts information.
function AccountsListAdminGridRowClick(grid, rowIndex, cellIndex, e)
{
LayoutLoadingShow();
var store = grid.getStore();
var record = store.getAt(rowIndex);
var accountName = record.data.Email;
var nameTextField = new Ext.form.DisplayField({
fieldLabel: 'Account Name',
value: accountName,
name: 'name'
});
nameTextField.setSize(((accountName.length+1) * 7), 20);
var items = [];
items.push(nameTextField);
Zen.AccountsListAdmin.Controls.ProfileTabPanel = new Ext.form.FormPanel({
cls: 'zen-account-panel',
id: 'ProfileTabPanel',
border: false,
autoScroll: true,
layout: 'fit',
title: 'Account: ' + nameTextField,
items: items
});
CreateAccountsListAdminTabPanel(Zen.AccountsListAdmin.Controls.ProfileTabPanel)
LayoutLoadingHide();
}