문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top