Undefined function
<p>I'm very new to JavaScript and I need some advice on why I am getting an error message that states <code>this.node</code> is <code>undefined</code>.</p>

<p>What I have is a app built on <code>ExtJs</code> using the MVC architect. In my Controller, I have developed a layout containing a tree and a grid. In the tree, there are parent nodes that can be added by clicking a New button and its method works perfectly. </p>

<p>However the method that will update a record by <code>id</code> from my database using the same form that is used to insert a record is generating a message stating the <code>this.node</code> is <code>undefined</code>. </p>

<p>This is my code for the <code>Edit handler</code>:</p>

<pre><code>handleBtnEdit: function (btn, ev, eOpts) {
    console.log(this);
    var id = parseInt(this.node.get("id")), rec = this.app.getStore("ProblemRequirements").getById(id);
    this.launchForm(rec);
}, 
handleBtnAdd: function (btn, ev, eOpts) {
    var rec = Ext.create("SPOT.model.ProblemRequirement");
    this.launchForm(rec);
}, 
handleBtnSave: function (btn, eOpts) {
    var win = btn.up("window"), pnl = win.down("form"), frm = pnl.getForm(), grid = pnl.down("grid"), store = grid.getStore(), rec = frm.getRecord();
    if (frm.isValid()) {
        rec.set(frm.getValues());
        win.setLoading("Saving, please wait...");
        rec.save({
            callback : function(rec, operation) {
                if (operation.success) {
                    win.close();
                    this.getStore("ProblemRequirements").load();
                    this.playMsg("Problem requirement successfully " + (operation.action === "update" ? "updated" : "created" ) + ".");
                } else {
                    win.setLoading(false);
                    Ext.Msg.alert("Error!", operation.error[0].ERROR);
                }
            },
            scope : this
        });
    }
}, 
launchForm: function (rec) {
    Ext.create("Ext.window.Window", {
        buttons : [{
            handler : this.handleBtnSave,
            scope : this,
            text : "Save"
        }, {
            handler : this.handleBtnCancel,
            scope : this,
            text : "Cancel"
        }],
        closable : false,
        draggable : false,
        iconCls : (rec.phantom ? "icon-add" : "icon-edit"),
        items : [{
            listeners : {
                afterrender : {
                    fn : function(pnl, eOpts) {
                        pnl.getForm().loadRecord(rec);
                    },
                    scope : rec
                }
            },
            xtype : "problemrequirementForm"
        }],

        modal : true,
        resizable : false,
        title : (rec.phantom ? "Create a New" : "Edit") + " Problem Requirement",
        width : 500
    }).show();
},
</code></pre>
