1. #1
    Ext User
    Join Date
    Nov 2009
    Posts
    12
    Vote Rating
    0
    MrTim is on a distinguished road

      0  

    Default Show/hide not working while using Ext.getCmp(<btn.id>)

    Show/hide not working while using Ext.getCmp(<btn.id>)


    Hi there. i am having an issue trying to make a button show after hiding it. I am currently using the show/hide functions but once i have hidden the button i cannot make it show again.

    below is the code that i am using:

    here is where i hide the button
    Code:
    btn1.el.on('click', function(sender, e) {
    // remove mapping
    var tfValue = Ext.getCmp(this.id.replace('btn', 'fld')).getValue();
    var newRec, aTfValue, newTfValue
    // if there are more than 2 items in the textfiel only remove the last one
    if (tfValue.indexOf(";") > 0) {
    aTfValue = tfValue.split(";")
    newRec = new Ext.data.Record({ name: aTfValue[aTfValue.length - 1] });
    newTfValue = tfValue.substring(0, tfValue.lastIndexOf(";"));
    } else {
    newRec = new Ext.data.Record({ name: tfValue });
    newTfValue = "";
    }
     
    _store_fContent.add(newRec);
    _store_fContent.sort('name', 'ASC');
    var txt = Ext.getCmp(this.id.replace("btn", "fld"));
    txt.setValue(newTfValue);
    this.hide();
    });
    and here is where i try to show it:
    Code:
    notifyDrop: function(ddSource, e, data) {
    // Reference the record (single selection) for readability
    var selectedRecord = ddSource.dragData.selections[0];
    // Load the record into the form
    _form.getForm().loadRecord(selectedRecord);
    //document.getElementById(sDropId).value = selectedRecord.data.name;
    var txt = Ext.getCmp(sDropId.id);
    var btn = Ext.getCmp(txt.id.replace("fld", "btn"))
     
    if (txt.getValue().length > 0) {
    txt.setValue(txt.getValue() + ";" + selectedRecord.data.name);
    } else {
    txt.setValue(selectedRecord.data.name);
    }
     
     
    // Delete record from the grid. not really required.
    ddSource.grid.store.remove(selectedRecord);
    btn.show();
    return (true);
    }
    as you can see i am accessing the button component using Ext.getCmp, i have had a look in the forums and it seems that this problem occurs whhen using .get(...) but not getCmp(...)

    plz help

    P.S an additional not is that it seems that my click event does not fire
    Last edited by MrTim; 9 Feb 2010 at 5:30 AM. Reason: Update

  2. #2
    Ext User
    Join Date
    Nov 2009
    Posts
    12
    Vote Rating
    0
    MrTim is on a distinguished road

      0  

    Default Fixed

    Fixed


    Hey there. my bad, i have now fixed this problem. It turns out that the problem was the way i was adding my listsner to the button. Instead of using btn1.el.on... i found that the code should have been btn1.addListsner(...

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."