1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    15
    Vote Rating
    0
    fabbydesign is on a distinguished road

      0  

    Default Answered: Problem loading data in form.

    Answered: Problem loading data in form.


    I don't understand why is not loading data in the form:

    This is the form

    Code:
    var editItemsMenu=Ext.create('Ext.form.Panel', {   //EDIT ITEMS
            id: 'edit-Items-Menu',
            layout: 'absolute',
            xtype:'form',
            defaultType: 'textfield',
            url:'menus/showItems/7/3',
            border: true,
            store:Ext.data.JsonStore({
                storeId:'store-edit-items-menu',
                fields:['objid','published', 'anchor', 'title','parameters','url'],
                autoLoad: true,
                waitMsg:'Loading',
                proxy:{
                    url:'menus/showItems/7/3',
                    type:'ajax',
                    reader:{
                        root:'data',
                        type:'json'
                    }
                }
            }),
            items: [
                radioExternalInternal,
            {
                name: 'objid',
                xtype: 'hidden'
            },
            { fieldLabel: 'Published',
                fieldWidth: 60,
                msgTarget: 'side',
                allowBlank: false,
                x: 5,
                y: 35,
                name: 'published',
                xtype: 'combo',
                allowBlank:false,
                store: [['yes', 'Yes'], ['no', 'No']],
                valueField: 'yes',
                editable:false,
                value:'yes'
            },{ fieldLabel: 'Anchor',
                //fieldWidth: 90,
                msgTarget: 'side',
                allowBlank: false,
                x: 5,
                y: 70,
                width:350,
                name: 'anchor'
            },{ fieldLabel: 'Title',
                
                msgTarget: 'side',
                allowBlank: false,
                x: 5,
                y: 105,
                width:350,
                name: 'title',
            },{ fieldLabel: 'Parameters',
                msgTarget: 'side',
                allowBlank: true,
                x: 5,
                y: 140,
                width:350,
                name: 'parameters'
            },{ fieldLabel: 'Url',   
                msgTarget: 'side',
                allowBlank: false,
                x: 5,
                y: 175,
                width: 500,
                name: 'url'
            }
            ],
            dockedItems: [{
                xtype: 'toolbar',
                border:true,
                items: [{
                    text: 'Save', // ADD ITEMS
                    iconCls: 'icon-save',
                    handler: function(){
                        var url = Ext.getCmp('list-Items-Menu').getStore('store-list-items-menu').proxy.url
                        if(url){
                            urlArr= url.split('/'); 
                            linkType=urlArr[2];
                        }
                        if(editItemsMenu.getForm().isValid()){
                            editItemsMenu.getForm().submit({
                                method:'POST',
                                url: 'menus/addItem/'+linkType,
                                success: function(fp, o){
                                    Ext.getCmp('bgMenuItems').layout.setActiveItem('list-Items-Menu');
                                    Ext.MessageBox.alert('Data added', 'Data added!');
                                    
                                    Ext.getCmp('list-Items-Menu').getStore('store-list-items-menu').load();//refresh
                                    
                                },
                                fail: function(fp, o) {
                                        //msg('Fail', 'erronious');
                                }
                            });
                        }
                        
                    }
                },'->', {
                    itemId: 'itemList',
                    text: 'Items list',
                    iconCls: 'icon-list',
                    handler: function(){
                        
                        Ext.getCmp('bgMenuItems').layout.setActiveItem('list-Items-Menu');
                        
                    }
                }]
            }]
            
    
    
        });
    And to load that, i use this code:

    HTML Code:
    Ext.getCmp('bgMenuItems').layout.setActiveItem('edit-Items-Menu');//load subpages list
                    Ext.getCmp('edit-Items-Menu').getForm().load({url:'menus/showItems/7/3'});
    I recieve this data from the link: menus/showItems/7/3

    HTML Code:
    {success:true,data:[ { objid:  "3", anchor:  null, title:  "Doctors in Mallorca", url:  "doctors", published:  "yes", parameters:  ""}]}
    There is no error, but the data is not loading in the form, and i don;t understand why...
    Thanks...wait your response

  2. Form dont have "store" property , use loadRecord method (http://docs.sencha.com/ext-js/4-1/#!...hod-loadRecord ) to load model to form.
    PHP Code:
    MyModelName.load(id, {
        
    success: function (record) {
             
    form.loadRecord(record);
        }
    }); 

  3. #2
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Answers
    44
    Vote Rating
    41
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

    Default


    Form dont have "store" property , use loadRecord method (http://docs.sencha.com/ext-js/4-1/#!...hod-loadRecord ) to load model to form.
    PHP Code:
    MyModelName.load(id, {
        
    success: function (record) {
             
    form.loadRecord(record);
        }
    }); 

Thread Participants: 1

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