PDA

View Full Version : Help accessing control formWindow



stratboogie
17 Jul 2008, 12:03 PM
Hello,
I have a gridPanel that I am creating in a formWindow along with other components. I am setting the grid to hidden in the config object of the gridPanel. I am attaching a handler to a button inside of the formWindow that will call a function to load the store and set the gridPanel to visible. I cannot figure out how to set a variable and find the gridPanel inside the formWindow and access the config object and set hidden = false for the gridPanel. Anyone have any suggestions?
Thanks
Tim

Code:
var onSearch = function() {
if (tbar.getFormWindow()){

var grdSearch = Ext.getCmp(tbar.formWindow.findById("grdSearch"));
grdSearch.store.load();
//grdSearch.renderTo("pgrdSearch");
//tbar.formWindow.add(grdSearch);
//tbar.formWindow.render(grdSearch, "pgrdSearch");
//tbar.formWindow.applyToMarkup("pgrdSearch");
tbar.formWindow.syncSize();
tbar.formWindow.doLayout(true);

};
}

var tbar = new Ext.ux.hhj.GridToolbar({
capabilities: {
Delete: true,
Download: true,
GetBlank: true,
GetById: true,
Insert: true,
Update: true
},
formWindow: new Ext.ux.hhj.FormWindow({
items: [
new Ext.Button({
text: "Search",
scope: this,
handler: onSearch
}),
new Ext.form.TextField({
fieldLabel: "FirstName",
name: "FirstName",
allowBlank: false
}),
new Ext.form.Checkbox({
fieldLabel: "Active",
name: "Active"
}),
new Ext.ux.hhj.GridPanel({
columns: [
{dataIndex: "Name", header: "Name"},
{dataIndex: "Supervisor", header: "Supervisor"},
{dataIndex: "Department", header: "Department"},
{dataIndex: "Location", header: "Location"}
],
hidden: true,
//plugins: [tbar],
// renderTo: tbar.formWindow(),

store: new Ext.data.Store({
baseParams: {
a: "GetByName",
limit: Ext.ux.hhj.PAGESIZE
},
remoteSort: true,
hidden: true,
sortInfo: {field: "Name"},
proxy: new Ext.data.HttpProxy({url: "Employee.aspx"}),
reader: new Ext.ux.hhj.DataReader({
id: "EmployeeId",
ts: "EmployeeTS",
fields: [
{name: "Name", type: "string"},
{name: "Supervisor", type: "string"},
{name: "Department", type: "string"},
{name: "Location", type: "string"}
]
})
})
})

],
title: "User Properties",
url: "Security/User.aspx",
html: "<DIV id=pgrdSearch></DIV>",
autoScroll: true
})
});

devnull
17 Jul 2008, 12:29 PM
In the future, please use code tags when posting code to the forums...
Give your grid an id and retrieve a reference to it using Ext.getCmp('idOfTheGrid')

stratboogie
17 Jul 2008, 12:49 PM
That got it - thanks!!
sorry about not using code tags. I am new.
Thanks again.
Tim