Frage

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.

War es hilfreich?

Lösung

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

Andere Tipps

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

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top