I am encountering a problem with the Ext.net TabPanel. Every time the page containing the tab panel is opened for the first time after the application has been rebuilt, it throws an error
Uncaught TypeError: Object [object Object] has no method 'getComponent'
. Interestingly, this issue occurs consistently after each rebuild but disappears upon refreshing the page. Below is the JavaScript code I am using to create a tab:
@X.XScript().ScriptBlock(@"
<script>
var addMainTab = function (tabPanel, id, url, title) {
var tab = tabPanel.getComponent(id);
if (!tab) {
tab = tabPanel.add({
id : id,
title : title,
closable : true,
loader : {
url : url,
renderer : 'frame',
loadMask : {
showMask : true,
msg : 'Loading ' + url + '...'
}
}
});
}
tabPanel.setActiveTab(tab);
}
</script>
");
This function is called when clicking on a menu item:
menuItem.Listeners.Click.Handler = "addMainTab(#{MainTabPanel}, 'someId', 'someurl', 'Tab title')";
Upon my investigation, it appears that some essential functions like getComponent and addTab are not initially included in the TabPanel definition upon the first load of the page after rebuild. Can anyone shed light on why this might be happening and suggest a solution? Any assistance would be greatly appreciated.