简体   繁体   English

Ext.net TabPanel问题

[英]Ext.net TabPanel issue

I'm experiencing an issue with Ext.net TabPanel. 我遇到了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' . 重建应用程序后,第一次打开带有选项卡面板的页面时,将引发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: 这是我用来创建标签的JS代码:

@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. 正如我发现的那样,在重建后页面的第一次加载时,某些功能(getComponent,addTab和其他功能)未包含在TabPanel的定义中。 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. 不要在Razor代码中使用#{control}名称。 Use App.ControlNameHere to reference the object in question. 使用App.ControlNameHere引用有问题的对象。 #{control} is only used in webforms. #{control}仅在网络表单中使用。

在执行此代码之前,是否已加载ExtJS框架文件?

看一下这个问题 ,我提到了如何将标签面板添加到主页。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM