在Enyo中,如何删除您创建的控件?

时间:2012-01-05 00:17:55

标签: enyo

一个例子,我创建了一个刷新按钮,显示在顶部,我可以使用代码以便以后删除此控件?????

带有刷新按钮的代码我想稍后在程序运行时删除

enyo.kind({
    name: "MyApps.MainApp",
    kind: enyo.VFlexBox,
    components: [

        {name: "gotCommentsSer", kind: "WebService",
            onSuccess: "gotComments", url: "testservice.json",
            onFailure: "gotCommentsFailure"},   
        {name: "getPendingSer", kind: "WebService",
            onSuccess: "gotPending", url: "testservice.json",
            onFailure: "gotPendingFailure"},

        {kind: "PageHeader", content: "Template"},
        {kind: "Button", caption: "Refresh", onclick: "btnRefresh"},
        {name:"curValue", content:("Sample Text")}, 
 //     {name: "feedUrl", kind: "Input", flex: 1},  
        {kind: "RichText", name: "PendingMsg", value: "To <b>boldly</b> go..", onchange: "richTextChange"},    
        {kind: "Scroller", flex: 1, components: [
            {kind: "VirtualRepeater", name: "list", onSetupRow: "setupRow", components: [
                 {kind: "Item", layoutKind: "HFlexLayout", components: [
                      {kind: "HtmlContent", name: "caption2" , onLinkClick: "btnClick"}
                  ]}
            ]}
        ]},        
        {kind: "Toolbar", name: "tabs"}  
    ],

1 个答案:

答案 0 :(得分:1)

你可能更容易.hide()你的控制而不是完全摧毁它。如果你真的想摆脱它,你应该回头参考动态创建组件的部分。要删除组件,请尝试:

this.$.Button.destroy();