1. #1
    Sencha User castitas's Avatar
    Join Date
    Sep 2011
    Location
    US
    Posts
    116
    Answers
    3
    Vote Rating
    2
    castitas is on a distinguished road

      0  

    Default Answered: setValues on the model

    Answered: setValues on the model


    I'm in a situation now where I am using a form to handle CRUD operations for a grid. When I use the form to update a record, I want to update the record in the grid. I've been looking around but it seems the only way to do so is set all fields individually.
    PHP Code:
            vals form.getValues();
            if( 
    form.getForm().isValid() ) {
                if(
    vals.project_id == null) {
                    
    //create new record
                    
    var rec = new rasp.model.admin.RProject(vals);
                    
    store.addSorted(rec);                
                } else {
                    
    //update record
                    
    rec store.getAt(form.recIdx);
                    
    rec.set('project_id',vals.project_id);
                    
    rec.set('project_name',vals.project_name);
                    
    rec.set('active',vals.active);
                    
    rec.set('money_code',vals.money_code);
                    
    rec.set('dba_id',vals.dba_id);
                    
    rec.set('division_id',vals.division_id);
                }
                
    store.sync();
            } 
    It would be more convenient a record if there was a function like a form's setValues function, which can take an object.

    PHP Code:
    rec.setValues({
                 
    'project_id'456,
                 
    'project_name'"Word",
                 
    'active''y',
                 
    'money_code'123,
                 
    'dba_id'123,
                 
    'b_dba'123,
                 
    'division_id'123,
    }); 
    word

  2. http://docs.sencha.com/ext-js/4-1/#!...del-method-set

    The "set" function actually takes an object as input.

    But what you really wanna do is take a look at the loadRecord and updateRecord functions of the form.

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

  3. #2
    Sencha Premium Member Fredric Berling's Avatar
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    186
    Answers
    4
    Vote Rating
    15
    Fredric Berling has a spectacular aura about Fredric Berling has a spectacular aura about

      0  

    Default


    http://docs.sencha.com/ext-js/4-1/#!...del-method-set

    The "set" function actually takes an object as input.

    But what you really wanna do is take a look at the loadRecord and updateRecord functions of the form.

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

  4. #3
    Sencha User castitas's Avatar
    Join Date
    Sep 2011
    Location
    US
    Posts
    116
    Answers
    3
    Vote Rating
    2
    castitas is on a distinguished road

      0  

    Default


    That was it, thanks
    word

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