1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    303
    Vote Rating
    3
    steve1964 is on a distinguished road

      0  

    Default Load data into a Form from a Datastore?

    Load data into a Form from a Datastore?


    How to load data into a Form from a datastore?
    I have a datastore, a model and form, i've tried to look at the examples but no one is related to datastore.
    An example would be appreciated, thanks...

  2. #2
    Sencha User
    Join Date
    Jan 2008
    Location
    Toronto, Canada
    Posts
    480
    Vote Rating
    4
    elishnevsky is on a distinguished road

      0  

    Default


    What is the problem?
    Retrieve a record from your store and pass it to form.load() method.
    http://dev.sencha.com/deploy/touch/d...el&member=load
    Just make sure that the form field names match the names of your model fields.

  3. #3
    Sencha User
    Join Date
    Aug 2010
    Posts
    303
    Vote Rating
    3
    steve1964 is on a distinguished road

      0  

    Default


    Thanks, but the point is that i don't know the syntax to do that, assuming my model is called Profile and the datastore ProfileStore,the datastore is loaded according then Profile Model and then?
    form.load(of what?), i'm missing the point...

  4. #4
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,337
    Vote Rating
    75
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Having a store just to load data into a form seems wasteful to me.

  5. #5
    Sencha User
    Join Date
    Jan 2008
    Location
    Toronto, Canada
    Posts
    480
    Vote Rating
    4
    elishnevsky is on a distinguished road

      0  

    Default


    Quote Originally Posted by steve1964 View Post
    Thanks, but the point is that i don't know the syntax to do that
    That's what the Documentation is for. Suppose you want to load the first record from the store into the form.
    Code:
    var record = ProfileStore.getAt(0);
    yourForm.load(record);
    This should do it.

  6. #6
    Sencha User
    Join Date
    Aug 2010
    Posts
    303
    Vote Rating
    3
    steve1964 is on a distinguished road

      0  

    Default


    Yes, thanks a lot, exactly what i need, i know that this can be achieved by doing an Ajax request in this form:

    Code:
    var profiledata = Ext.ModelMgr.create(AjaxResponse, 'profile');
    this.profileForm.load(profiledata);
    but i like more datastore way...

  7. #7
    Sencha User
    Join Date
    Aug 2010
    Posts
    303
    Vote Rating
    3
    steve1964 is on a distinguished road

      0  

    Default


    I solved in this way:

    Code:
           var profile = Ext.regModel('profile',{
               fields: [
                   { name: 'username', type: 'string' },
                   { name: 'alias', type: 'string' },
                   { name: 'sex',  type: 'string' },
                   { name: 'AgeRange_ageRangeId',  type: 'string' }
               ]
           });
    Code:
                        Ext.Ajax.request({
                                               url: 'php/profile_load.php?username=' + formL.getValues().username,
                                                success: function(response, opts) {
                                                    var responseObj=Ext.decode(response.responseText);
                                                    if(responseObj.success){
                                                        try {
                                                            console.log(responseObj.text.alias);
                                                        } catch (e) {
    
                                                        }
                                                        var profiledata = Ext.ModelMgr.create(responseObj.text, 'profile');
                                                        formP.load(profiledata);
                                                    } else {
                                                        alert(responseObj.text);
                                                    }
                                                },
                                                failure:function(response, opts){
    
                                                },
                                                scope:this
                       });

  8. #8
    Sencha User
    Join Date
    Feb 2013
    Posts
    1
    Vote Rating
    0
    torrante is on a distinguished road

      0  

    Default Question

    Question


    How to load a dynamic list (mysql/php) into combobox???

Similar Threads

  1. Replies: 2
    Last Post: 11 May 2009, 2:00 AM
  2. my DataStore dont load Data
    By aityahia in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 24 Feb 2009, 12:26 PM
  3. How to load remote datastore of combobox when loading form?
    By rukiyem in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 17 Jul 2008, 6:42 AM
  4. datastore load during form load
    By mthad in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 8 Jul 2008, 7:26 AM
  5. Problem with Form response and getting DataStore data
    By mrbse in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 17 Mar 2008, 9:53 AM

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar