Ted pottel
Ted pottel

Reputation: 6983

In Enyo, how do you remove a control you created?

One example, I have a refresh buttons I created that is displayed on top, could I have code to later on remove this control?????

code with refresh button in it I would like to remove later on as the program is running

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"}  
    ],

Upvotes: 1

Views: 1231

Answers (1)

Pre101
Pre101

Reputation: 2370

It might be easier for you just to .hide() your control rather than destroy it completely. If you really want to get rid of it, you should refer back to the section on dynamically creating components. To remove the component try:

this.$.Button.destroy();

Upvotes: 1

Related Questions