1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    3
    Vote Rating
    0
    Isht.Ae is on a distinguished road

      0  

    Default Set Triggerfield value from controller

    Set Triggerfield value from controller


    I try to binding data from window grid that show by trigger field click.

    This is my form with triggerfield :
    Code:
    initComponent: function() {
        var me = this;
    
    
        Ext.applyIf(me, {
    
    
            ....other config...
    
    
            items: [
                {
                    xtype: 'form',
                    itemId: 'groupDetailForm',
                    border: false,
                    layout: {
                        type: 'auto'
                    },
                    bodyPadding: 10,
                    preventHeader: true,
                    title: 'My Form',
                    items: [
    
                        ....other items...
    
                        {
                            xtype: 'triggerfield',
                            padding: '0 0 5 0',
                            width: 350,
                            fieldLabel: 'Nama Kontak',
                            name: 'namaJamaah',
                            itemId: 'namaLead',
                            triggerCls: ' x-form-search-trigger',
                            onTriggerClick: function(){
                                Ext.widget('listjamaahgroup').show();
                            }
                        },
    
                         ....other items...
    
                    ]
                }
            ]
        });
    
        me.callParent(arguments);
    }});
    Next, my window with grid to list data :
    Code:
    Ext.define('ResApp.view.group.ListJamaahGroup', {
    extend: 'Ext.window.Window',
    alias:'widget.listjamaahgroup',
    
     height: 400,
    width: 750,
    title: 'Daftar Jamaah',
    modal: true,
    hidden: false,
    floating: true,
    resizeable: false,
    
    initComponent: function() {
        var me = this;
    
        Ext.applyIf(me, {
            items : [
                {
                        xtype: 'gridpanel',
                        autoScroll: true,
                        border:false,
                        title: 'Daftar Anggota',
                        itemId: 'gridAnggota',
                        preventHeader: true,
                        forceFit: true,
                        flex: 1,
                        store: 'Jamaah',
                        allowDeselect : true,
                        viewConfig: {
                            autoScroll: true
                        },
                        dockedItems: [
                            {
                                xtype: 'toolbar',
                                dock: 'top',
                                cls:'border-bottom',
                                items: [
                                    {
                                        xtype: 'button',
                                        text: 'Pilih',
                                        iconCls:'edit',
                                        action: 'selectJamaahGrp',
                                        itemId: 'selectJamaahGrp'
                                    },
                                    {
                                        xtype: 'button',
                                        text: 'Baru',
                                        iconCls:'add'
                                    }
                                ]
                            }
                        ],
                        columns: [
    
                        ....Grid columns...
    
                        ]                            
                }
            ]
    
        });
    
        me.callParent(arguments);
    }});

    And this is my controller :
    Code:
    Ext.define('ResApp.controller.GroupDetails', {
    extend: 'Ext.app.Controller',
    stores: [
        'Group', 'Jamaah'
    ],
    models: [
      'Group', 'Jamaah'
    ],
    views:[
        'group.Detail',
        'group.ListJamaahGroup'
    ],
    init: function(){
        this.control({
            ...
    
             'button[action=selectJamaahGrp]': {
                click: this.selectJamaahGrp
            },
    
            ...
        });
    },
    
    ... other functions ...
    
    selectJamaahGrp: function(button, e, options) {
        //windowDetail.hide();
    
        var grid = button.up('grid');
        if (grid) {
            var windowDetail = Ext.widget('groupdetail');
            var form = windowDetail.down('form');
    
             var sm = grid.getSelectionModel();
            var rs = sm.getSelection();
            if (!rs.length) {
                Ext.Msg.alert('Info', 'Pilih salah satu');
                return;
            }
    
             var data = grid.getSelectionModel().getSelection()[0];
            //how to setValue to triggerfield from here
        }
        button.up('listjamaahgroup').destroy();
    },
    batalSelClick: function(button, e, options) {
        button.up('listjamaahgroup').destroy();
    }
    ... other functions ...})
    My problem is, i can't figure how to setValue the triggerfield from my controller. Or there's another way to do it?

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,918
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You already have access to your form., just go down to your field

    form.down('#namaLead').setValue()

    Scott.

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    3
    Vote Rating
    0
    Isht.Ae is on a distinguished road

      0  

    Default


    Hi Scott,

    Thanks for reply,

    I've tried your solution. but the triggerfield still empty. I also tried to setValue for another field with same result.
    Any idea?

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,918
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Did you check to see if: form.down('#namaLead') was returning a valid assignment?

    Scott.

  5. #5
    Sencha User
    Join Date
    Jun 2012
    Posts
    3
    Vote Rating
    0
    Isht.Ae is on a distinguished road

      0  

    Default


    Hi Scott,

    I've try this on the controller
    Code:
                form.down('#namaLead').setValue('Value Test');
                console.log(form.down('#namaLead'));
    then check it with firebug. It's return the triggerfield object and the value was 'Value Test', but, in my form, still blank...

Thread Participants: 1

Tags for this Thread

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..." hd porno faketaxi