Apr 09, 2009, 4:49 PM
after adding tabs dynamically, set focus back to main form
Hi,
I have a form which has main form data and a tabpanel, on the main form users can fill in data of a company, when they click on the button: "Add Type", a second tab will be add to the panel, ...
now after I've added the tab, the focus is on a control in that tab, what i want is to set focus back to a control of the main form data.
I have a form which has main form data and a tabpanel, on the main form users can fill in data of a company, when they click on the button: "Add Type", a second tab will be add to the panel, ...
now after I've added the tab, the focus is on a control in that tab, what i want is to set focus back to a control of the main form data.
<script type="text/javascript">
function addTab(tabPanel,id, url, name) {
var tab = tabPanel.getComponent(id);
if (!tab) {
tab = tabPanel.add({
id: id,
title: name,
closable: false,
autoLoad: {
showMask: true,
url: url,
mode: 'iframe',
maskMsg: 'Loading ' + name + '...'
}
});
}
tabPanel.setActiveTab(tab);
}
function reloadTabCompany(_ID, _CompanyID, _CompanyTypeID, _LoadData) {
Company.load({
url: "frmAddEditCompanyTypeData.aspx",
params: { ID: _ID,
__WebConsolePostData: document.getElementById('__WebConsolePostData').value,
CompanyID: _CompanyID,
CompanyTypeID: _CompanyTypeID,
LoadData: _LoadData }
});
}
</script>...
<ext:FieldSet runat="server" Collapsible="true" ID="FieldSetCompany" Title="Company Data">
<Body>
...
</Body>
</ext:FieldSet>
<ext:FieldSet runat="server" StyleSpec="padding-bottom:5px" Collapsible="true" ID="FieldSetDetails" Title="Company Details">
<Body>
<ext:TabPanel ID="TabPanelCompanyDetails" runat="server" ActiveTabIndex="0" Height="450">
<Tabs>
<ext:Tab ID="Company" runat="server" Title="Company" Closable="false">
<AutoLoad
Url="frmAddEditCompanyTypeData.aspx"
Mode="IFrame"
ManuallyTriggered="true"
ShowMask="true"
NoCache="true"
>
<Params>
<ext:Parameter Name="ID" Value="-1" />
<ext:Parameter Name="__WebConsolePostData" Value="={document.getElementById ('__WebConsolePostData').value}" />
<ext:Parameter Name="CompanyID" Value="-1" />
<ext:Parameter Name="CompanyTypeID" Value="-1" />
<ext:Parameter Name="LoadData" Value="True" />
</Params>
</AutoLoad>
</ext:Tab>
</Tabs>
...
</ext:TabPanel>
</Body>
</ext:FieldSet>
Thanks.