1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    17
    Vote Rating
    0
    JoePie is on a distinguished road

      0  

    Default Unanswered: Dynamic Form

    Unanswered: Dynamic Form


    I am using a simple form that I found in the examples. What I want is for the form to be populated with dynamic data when the user opens the form. No buttons, like I saw in the XML demo. I don't know XML, so I am trying to use JSON store. If someone could please help me out. Here is the code I am using:

    PHP Code:
    Ext.require([
        
    'Ext.form.*',
        
    'Ext.layout.container.Column',
        
    'Ext.tab.Panel'
    ]);

    Ext.onReady(function(){

    Ext.define('formModel', {
            
    extend:'Ext.data.Model',

            
    fields: [
                         {
    name'first'type'string'},
                         {
    name'last'type'string'},
                         {
    name'company'type'string'}
                    ]
    });

        
    Ext.QuickTips.init();

        var 
    bd Ext.getBody();
        

        
    /*
         * ================  Simple form  =======================
         */
        
    bd.createChild({tag'h2'html'Form 1 - Very Simple'});
        
                    var 
    memoryStore Ext.create('Ext.data.Store',{
                        
    model'formModel',
                        
    proxy: {
                                    
    type'ajax',
                                    
    url: ('formData.html'),
                                    
    reader'json'
                                
    },
                        
    autoLoadtrue
                        
    });


        var 
    simple Ext.create('Ext.form.Panel', {
            
            
    url:'save-form.php',
            
    frame:true,
            
    title'Simple Form',
            
    bodyStyle:'padding:5px 5px 0',
            
    width350,
            
    storememoryStore,  //**Store added by me
            
    fieldDefaults: {
                
    msgTarget'side',
                
    labelWidth75
            
    },
            
    defaultType'textfield',
            
    defaults: {
                
    anchor'100%'
            
    },

            
    items: [{
                
    fieldLabel'First Name',
                
    name'first',
                
    allowBlank:false
            
    },{
                
    fieldLabel'Last Name',
                
    name'last'
            
    },{
                
    fieldLabel'Company',
                
    name'company'
            
    }],

            
    buttons: [{
                
    text'Save'
            
    },{
                
    text'Cancel'
            
    }]
        });

        
    simple.render(document.body);
    }); 
    And the data,
    PHP Code:
    [ {"first":"Baba","last":"Booey","company":"JP"} ] 
    Thank you for any help

  2. #2
    Sencha User
    Join Date
    Oct 2011
    Location
    Sweden
    Posts
    36
    Answers
    10
    Vote Rating
    0
    JambaFun is on a distinguished road

      0  

    Default


    Hi JoePie,

    My only advice is to read the official guides from Sencha.

    http://docs.sencha.com/ext-js/4-0/#!...etting_started
    http://docs.sencha.com/ext-js/4-0/#!/guide/class_system
    http://docs.sencha.com/ext-js/4-0/#!...n_architecture

    You are not going to learn anything by using copy-paste code. If these guides intimidate you or make no sense you probably have to start with something easier than Ext JS.

    Best Regards

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    16
    Answers
    2
    Vote Rating
    0
    kelv1n is on a distinguished road

      0  

    Default


    Hi JoePie, sorry I can't help with, I'm a newb myself.. but I'd like to reply to JambaFuns comment - It depends, some people learn better following instruction, others learn by dissecting and rebuilding (copy-n-paste)..

Thread Participants: 2

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