简体   繁体   English

客户端上的Ext.Net链接按钮

[英]Ext.Net Link Button on Client Side

I have created window on sever side with LinkButton on bottom 我在服务器端创建了窗口,在底部创建了LinkBut​​ton

  <ext:Window runat="server" ID="winIndex" Title="Test">
        <AutoLoad Url="index.html" Mode="IFrame" />
        <Buttons>
            <ext:LinkButton runat="server" ID="btn" Text="Test Button">
                <Listeners>
                    <Click Handler="Ext.msg.alert('Alert','test');" />
                </Listeners>
            </ext:LinkButton>
        </Buttons>
    </ext:Window>

i wanted to create this window on client side using javascript this is what i tried 我想使用javascript在客户端创建此窗口,这是我尝试过的

var CreateWindow = function () {
            var windowConfig = {
                id: "winIndex",
                hidden: false,
                closeAction: "hide",
                title: "Test",
                buttons: [
                    {
                        id: "btn",
                        text: "Test Button",
                        listeners:
                            {
                                click:
                                {
                                    fn: function (el, e) {
                                        Ext.msg.alert('Alert','test');
                                    }
                                }
                            }
                    }
                ],
                autoLoad: {
                    url: "index.html",
                    nocache: true,
                    mode: "iframe",
                    showMask: true,
                    triggerEvent: "show",
                    reloadOnEvent: true
                }
            }
            new Ext.Window(windowConfig)
        }

Window rendered perfectly using javascript too except LinkButton. 除了LinkBut​​ton之外,窗口也使用javascript完美呈现。 it draws normal button rather than LinkButton but i need link button just like server side ext control. 它绘制普通按钮而不是LinkBut​​ton,但是我需要像服务器端ext控件一样的链接按钮。 Any help will be appreciated. 任何帮助将不胜感激。

From your code snippet I am assuming you are referring to Ext.NET 1.x and Ext JS 3.x. 从您的代码片段中,我假设您是指Ext.NET 1.x和Ext JS3.x。

If so, by default, when using the buttons configuration option for a new Ext.Window, the default component used will be Ext.Button s. 如果是这样,默认情况下,当对新的Ext.Window使用buttons配置选项时,使用的默认组件将是Ext.Button

LinkButtons are a useful extension from Ext.NET, and they have their xtype as netlinkbutton so you would have to explicitly set that, for example: LinkBut​​tons是Ext.NET的有用扩展,它们的xtypenetlinkbutton因此您必须明确设置它,例如:

new Ext.Window({
    title: "Test",
    height: 300,
    width: 300,
    buttons: [{
        id: "btn",
        xtype: 'netlinkbutton',
        text: "Test Button",
        listeners: {
            click: {
                fn: function (el, e) {
                    Ext.Msg.alert('Alert', 'test');
                }
            }
        }
    }]
}).show();

Notice the key thing is xtype: netlinkbutton 注意关键是xtype: netlinkbutton

Hope that helps! 希望有帮助!

PS Note that in Ext.NET 3, the LinkButton is renamed to HyperLinkButton and its xtype is now nethyperlinkbutton . PS注意,在Ext.NET 3中, LinkButton被重命名为HyperLinkButton ,其xtype现在为nethyperlinkbutton

use netlinkbutton as xtype in ExtJs. 在ExtJs中将netlinkbutton用作xtype。 netlinkbutton is exactly what LinkButton is in Ext.net netlinkbutton正是Ext.net中的LinkBut​​ton

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

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