1
votes

I'm experiencing an issue with Ext.net TabPanel. When the page with tab panel is opened first time after the app was rebuilt it throws Uncaught TypeError: Object [object Object] has no method 'getComponent'. The problem happens each time the application is rebuilt and then disappears after page refresh. Here's JS code I use 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>
");

It's called on menu item click:

menuItem.Listeners.Click.Handler = "addMainTab(#{MainTabPanel}, 'someId', 'someurl', 'Tab title')";

As I figured out some functions (getComponent, addTab and others) are not included into the definition of TabPanel at first load of the page after rebuild. Does anyone have any idea why it may happen and how it can be fixed? I'd appreciate any help.

3

3 Answers

1
votes

Don't use #{control} name in Razor code. Use App.ControlNameHere to reference the object in question. #{control} is only used in webforms.

0
votes

Does the ExtJS framework files get loaded before this code is executed?

0
votes

take a look at this question ,which I mentioned how I add tab panel to the main page.