1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    4
    Vote Rating
    0
    Jakob is on a distinguished road

      0  

    Default Answered: FieldSet - loadRecord?!

    Answered: FieldSet - loadRecord?!


    Hey there,

    i have a problem to reference my fieldset/form in my controller and load the record in it.

    View:
    Code:
    Ext.define('RAR.view.order.OrderForm' ,{
        extend: 'Ext.form.FieldSet',
        alias : 'widget.orderform',
    
    
        margin: '0 0 0 10',
    
    
        title:'Order details',
    
    
        defaults: {
            width: 240,
            labelWidth: 90
        },
    
    
        defaultType: 'textfield',
    
    
        items: [{
            fieldLabel: 'Id',
            name: 'IDrec'
        },{
            fieldLabel: 'Firma',
            name: 'Firma'
        },{
            fieldLabel: 'Nettosumme',
            name: 'NSumme'
        },{
            xtype: 'datefield',
            fieldLabel: 'Datum',
            name: 'RecDatum'
        }]
    });
    Controller:
    Code:
    Ext.define('RAR.controller.OrderController', {
        extend: 'Ext.app.Controller',
    
    
        stores: ['Orders'],
    
    
        models: ['Order'],
    
    
        views: [
            'order.OrderGrid',
            'order.OrderForm',
            'order.OrderPanel'
        ],
    
    
        refs: [{
            ref: 'orderForm',
            selector: 'orderform'
        }],
        
        init: function() {
    
    
            this.control({
                'ordergrid': {
                    selectionchange: this.gridSelectionChange
                }
            });
        },
    
    
        gridSelectionChange: function(model, records) {
    
    
            if (records[0]) {
                this.getOrderForm().getForm().loadRecord(records[0]);
            }
        }
        
    });
    When I excecute this i get the error: "TypeError: this.getOrderForm(...).getForm is not a function"

    Before this, I tried it with another reference into the OrderController:

    Code:
        refs: [{
            ref: 'orderForm',
            selector: 'form'
        }],
    This works, but now I must specify the form I would fill.

    I think my question is now: Which function or reference I can use to load the record in my FieldSet.

    Thanks for your time.
    Jakob

  2. Quote Originally Posted by Jakob View Post
    but why can i reference the same fieldset with...
    You can't. The selector is 'form', which will match an Ext.form.Panel, not the fieldset.

    To target more specific components you can use a custom xtype (via subclassing) or an itemId. Personally I wouldn't use an itemId unless I also have a custom xtype earlier in the selector.

    If you haven't already, make sure you've read this explanation of component queries:

    http://docs.sencha.com/ext-js/4-1/#!...ComponentQuery

    Perhaps I still haven't understood your question?

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,573
    Answers
    540
    Vote Rating
    310
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    A fieldset is not a form. The method's getForm and loadRecord are method's of Ext.form.Panel:

    http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.Panel

    Whereas what you have is a Ext.form.FieldSet:

    http://docs.sencha.com/ext-js/4-1/#!....form.FieldSet

    If you only have a small number of fields then you could just copy the values from the record manually. If you really want to use loadRecord then just add in a form. i.e. Make the first child of the fieldset a form and move the fields inside it.

  4. #3
    Sencha User
    Join Date
    May 2011
    Posts
    4
    Vote Rating
    0
    Jakob is on a distinguished road

      0  

    Default


    Thanks for reply!

    I get the point, but why can i reference the same fieldset with

    Code:
    refs: [{
            ref: 'orderForm',
            selector: 'form'
        }],
    and then I can use the loadRecord method. Is there a possibility to specify this reference to get alwas the right form? Do u know what I mean?

    Greets, Jakob

  5. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,573
    Answers
    540
    Vote Rating
    310
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      1  

    Default


    Quote Originally Posted by Jakob View Post
    but why can i reference the same fieldset with...
    You can't. The selector is 'form', which will match an Ext.form.Panel, not the fieldset.

    To target more specific components you can use a custom xtype (via subclassing) or an itemId. Personally I wouldn't use an itemId unless I also have a custom xtype earlier in the selector.

    If you haven't already, make sure you've read this explanation of component queries:

    http://docs.sencha.com/ext-js/4-1/#!...ComponentQuery

    Perhaps I still haven't understood your question?

  6. #5
    Sencha User
    Join Date
    May 2011
    Posts
    4
    Vote Rating
    0
    Jakob is on a distinguished road

      0  

    Default


    Thanks!

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