1. #1
    Sencha User Misiu's Avatar
    Join Date
    Jun 2012
    Location
    Poland
    Posts
    206
    Answers
    6
    Vote Rating
    33
    Misiu has a spectacular aura about Misiu has a spectacular aura about

      0  

    Default Answered: MessageBox pass extra param to handler

    Answered: MessageBox pass extra param to handler


    I've created context menu for a control like so:
    Code:
    onEventContextMenu: function (s, rec, e) {
            e.stopEvent();
    
            if (!s.ctx) {
                s.ctx = new Ext.menu.Menu({
                    items: [{
                        text: 'Delete event',
                        iconCls: 'icon-delete',
                        scope: this,
                        handler : function() {
                        Ext.MessageBox.show({
                                        title : 'Reason',
                                        msg : 'place reason:',
                                        width : 300,
                                        buttons : Ext.MessageBox.OKCANCEL,
                                        multiline : true,
                                        fn : this.showResultText(buttonId, text, rec)//how to pass rec to handler?
                                    });
                        }
                    },{
                                text : 'Accept',
                                iconCls : 'accept',
                                handler : function() {
                                    alert(rec.get('Title'));
                                }
                            }, 
                    ]
                });
            }
            s.ctx.rec = rec;
            s.ctx.showAt(e.getXY());
        },
        
        showResultText : function (btn, text, record){
        alert(btn);
            if (btn == 'cancel') {
                alert(text + ' cancel');
            }
            if (btn == 'ok') {
                alert(record.get('Title'));
            }
        },
    I can access rec in second option. But when user choose first option he gets messageBox to enter some text, after than I would like to access rec from showResultText function.
    How to do that? Add extra parameter? If yes, then how?

  2. I've changed a bit my code:
    Code:
        onEventContextMenu: function (s, rec, e) {
            e.stopEvent();
    
            if (!s.ctx) {
                s.ctx = new Ext.menu.Menu({
                    items: [{
                        text: 'Delete event',
                        iconCls: 'icon-delete',
                        scope: this,
                        handler : function() {
                        Ext.MessageBox.show({
                                        title : 'Reason',
                                        msg : 'place reason:',
                                        width : 300,
                                        buttons : Ext.MessageBox.OKCANCEL,
                                        multiline : true,
                                        scope: this,
                                        fn : function(btn,text){ if (btn == 'ok') this.showResultText(rec);}
                                        //fn : this.showResultText(buttonId, text, rec)
                                    });
                        }
                    },{
                                text : 'Accept',
                                iconCls : 'accept',
                                handler : function() {
                                    alert(rec.getName());
                                }
                            }, 
                    ]
                });
            }
            s.ctx.rec = rec;
            s.ctx.showAt(e.getXY());
        },
        
        showResultText : function (record, reason){
                alert(record.getName());
        },
    Now I can access record from my function, but if anyone knows how to pass extra param to handler function please let me know

  3. #2
    Sencha User Misiu's Avatar
    Join Date
    Jun 2012
    Location
    Poland
    Posts
    206
    Answers
    6
    Vote Rating
    33
    Misiu has a spectacular aura about Misiu has a spectacular aura about

      0  

    Default


    I've changed a bit my code:
    Code:
        onEventContextMenu: function (s, rec, e) {
            e.stopEvent();
    
            if (!s.ctx) {
                s.ctx = new Ext.menu.Menu({
                    items: [{
                        text: 'Delete event',
                        iconCls: 'icon-delete',
                        scope: this,
                        handler : function() {
                        Ext.MessageBox.show({
                                        title : 'Reason',
                                        msg : 'place reason:',
                                        width : 300,
                                        buttons : Ext.MessageBox.OKCANCEL,
                                        multiline : true,
                                        scope: this,
                                        fn : function(btn,text){ if (btn == 'ok') this.showResultText(rec);}
                                        //fn : this.showResultText(buttonId, text, rec)
                                    });
                        }
                    },{
                                text : 'Accept',
                                iconCls : 'accept',
                                handler : function() {
                                    alert(rec.getName());
                                }
                            }, 
                    ]
                });
            }
            s.ctx.rec = rec;
            s.ctx.showAt(e.getXY());
        },
        
        showResultText : function (record, reason){
                alert(record.getName());
        },
    Now I can access record from my function, but if anyone knows how to pass extra param to handler function please let me know

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..."