1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    4
    Vote Rating
    0
    sarah_iseli is on a distinguished road

      0  

    Default POST with remoteProxy and FormPanel doesn't work

    POST with remoteProxy and FormPanel doesn't work


    I've a mvc project and I'm trying to send the data from the FormPanel to a remote URL.

    There we have a J2EE Backend. The specific method will be called, but the POST values are not sending.

    In the controller I take the values from the form and add them to a store, load the store and do a sync:
    rapportAddStore.setData(rapportValues);
    rapportAddStore.load();

    rapportAddStore.sync();

    What must I do, to sent the POST values correctly?


    Below is a extraction from the code:


    Model:
    Code:
    Ext.define('mira.model.Rapport', {
        extend:    'Ext.data.Model',
        requires: [
            'mira.model.Project',
            'mira.model.ServiceType'
        ],
        config:    {
            idProperty: 'id',
            fields: [
                    {name: 'id', type: 'number'},
                    {name: 'commentExternal', type: 'string'},
                    {name: 'commentInternal', type: 'string'},
                    {name: 'date', type: 'date'},
                    {name: 'workTime', type: 'float'},
                                    {name: 'travelTime', type: 'float'},
                    {name: 'isClearable', type: 'boolean'},
                    {name: 'state', type: 'string'},
                    {name: 'serviceTypeId', type: 'number'},
                    //{name: 'serviceTypeName', mapping: 'serviceType.name', type: 'string'},
                    {name: 'projectId', mapping: 'project.id', type: 'number'}
            ],
            belongsTo: [{
                model: 'mira.model.Project',
                name: 'Project',
                primaryKey: 'id',
                foreignKey: 'projectId'
            }],
            hasOne: [{
                model: 'mira.model.ServiceType',
                name: 'ServiceType',
                primaryKey: 'id',
                foreignKey: 'serviceTypeId'
            }],
        }
    });
    
    
    Store:
    Code:
    Ext.define('mira.store.Rapports', {
        extend:    'Ext.data.Store',
    
    
        requires: [
                    'mira.model.Rapport',
                    'Ext.data.proxy.JsonP',
                    'Ext.data.proxy.Rest'
        ],
        
        config:    {
            model: 'mira.model.Rapport',
            sorter: 'date',
            grouper: {
                direction: 'DESC',
                groupFn: function(record) {
                    return Ext.Date.format(record.get('date'), 'd. F Y');
                }
            },
            // Create Proxy!!!
            proxy: {
                    type: 'rest',
                    appendId: false,
                    api: {
                        create : 'https://....ch/ch.soreco.mira/rest/rapports/rapport',
                        read   : 'https://....ch/ch.soreco.mira/rest/rapports/miraUser',
                        update : 'https://....ch/ch.soreco.mira/rest/rapports/rapport',
                        destroy: 'https://....ch/ch.soreco.mira/rest/rapports/rapport'
                   },
                   actionMethods: {
                        create: 'POST',
                        read: 'GET',
                        update: 'POST',
                        destroy: 'DELETE'
                   },
                    extraParams: {
                            format: 'js',
                            username: 'blatn2'
                    }
                }
        }
    
    
    });
    View:
    Code:
    Ext.define('mira.view.RapportAdd', {
        extend: 'Ext.form.Panel',
        xtype: 'rapportadd',
        id: 'rapportForm',    
        requires: [
            'Ext.Carousel',
            'Ext.form.FieldSet',
            'Ext.Label',
            'Ext.form.Panel',
            'mira.view.TimePicker',
            'mira.view.AutocompleteField',
            'mira.view.HourlyRateSelect',
            'mira.view.ProjectSelect',
            'Ext.field.Toggle',
            'mira.view.ServiceTypeSelect',
            'mira.view.TimePickerText'
        ],
        config:  {
            // if the layout vbox and the flex = 1 from carousel
            // isn't set the carousel didn't appear
             layout: 'vbox',
            
            items: [{
                xtype : 'carousel',
                flex: 1,
    
    
                xtype:'carousel',
                items: [{
                    // firstPage --> Projekt
                    items: {
                        xtype: 'fieldset',
                        items: [{
                            //TODO: add same css as label from textfield!!
                            xtype: 'label',
                            html: addRapport.firstPage.CUSTOMER
                        },
                        {
                            xtype: 'autocompletefield',
                            //name: 'customerId',
                            value: '',
                            // Label wirkt nicht zusammen mit config!
                            /*label: 'Das ist ein Label',
                            labelAlign: 'top',*/
                            config: {
                                //store: mira.store.CustomersSelectedByUser,
                                proxy: {
                                    type: 'jsonp',
                                    url: 'https://....ch/ch.soreco.mira/rest/customers/miraUserCustomer?username=isels3',
                                },
                                resultsHeight: 300,
                                needleKey: 'name',
                                labelKey: 'enterprise'
                            }
                        },
                        {
                            xtype: 'projectselect',
                            name: 'projectId',
                            label: addRapport.firstPage.PROJECT,
                            labelAlign: 'top'
                        },
                        {
                            xtype: 'hourlyrateselect',
                            name: 'hourlyRateId',
                            label: addRapport.firstPage.HOURLYRATE,
                            labelAlign: 'top'
                        }]
                    }
                },
                {
                    // secondPage --> Zeit
                    items: {
                        xtype: 'fieldset',
                        items: [
                        {
                            xtype: 'textfield',
                            name: 'worktime',
                            label: addRapport.secondPage.WORKTIME,
                            labelAlign: 'top'
                        },
                        {
                            xtype: 'textfield',
                            name: 'traveltime',
                            label: addRapport.secondPage.TRAVELTIME,
                            labelAlign: 'top',
                        },
                        {
                             xtype: 'datepickerfield',
                             label: addRapport.secondPage.DATE,
                             labelAlign: 'top',
                            name: 'date',
                            value: new Date(),
                            dateFormat: 'd.m.Y',
                            picker: {
                                //slotOrder: ['day', 'month', 'year'],
                                yearFrom: parseInt(Ext.Date.format(new Date(), 'Y'), 10)-1,
                                yearTo: parseInt(Ext.Date.format(new Date(), 'Y'), 10)+1
                            }
                        }
                        ]
                    }
                },
                {
                    // thirdPage --> Art
                    items: {
                        xtype: 'fieldset',
                        items: [{
                            xtype: 'togglefield',
                            name: 'clearable',
                            label: addRapport.thirdPage.CLEARABLE,
                            labelAlign: 'top',
                            value: 1
                        },
                        {
                            xtype: 'servicetypeselect',
                            name: 'servicetypeId',
                            label: addRapport.thirdPage.SERVICETYPE,
                            labelAlign: 'top'
                        }]
                    }
                },
                {
                    // forthPage --> Kommentar
                    items: {
                        xtype: 'fieldset',
                        items: [{
                            xtype: 'textareafield',
                            maxRows: 4, 
                            name: 'commentExternal',
                            label: addRapport.forthPage.COMMENTEXTERN,
                            labelAlign: 'top',
                        },
                        {
                            xtype: 'textfield',
                            name: 'commentInternal',
                            label: addRapport.forthPage.COMMENTINTERN,
                            labelAlign: 'top',
                        },
                        {
                            xtype: 'button',
                            ui: 'confirm',
                            text: buttons.SAVE,
                            action: 'submitRapportAdd'
                        }]
                    }
                }] 
            }]
        }
    }
    );
    Controller:
    Code:
    Ext.define('mira.controller.RapportAdd', {
        extend: 'Ext.app.Controller',
        config: {
            refs: {
                rapportForm: '#rapportForm',
                projectSelect: '#projecthallo',
                
            },
            views: ['RapportAdd', 'AutocompleteField', 'ProjectSelect', 'HourlyRateSelect']
        },
        
        
    
    
        init: function() {
            this.control({
                'button[action=submitRapportAdd]': {
                    tap: 'submitRapportForm'
                },
                //enterpriseTxt: {
                // this will be handel in AutocompleteField
                //},
                projectSelect: {
                    change: 'changeProject'
                }
            });
        },
        
        submitRapportForm: function() {
            var form = this.getRapportForm();
            var rapportValues = form.getValues();
            
            var rapportAddStore = Ext.create("mira.store.Rapports");
            rapportAddStore.setData(rapportValues);
            rapportAddStore.load();    
                
            rapportAddStore.sync();
        }
        
    });

  2. #2
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Berne, Switzerland
    Posts
    714
    Vote Rating
    42
    ingo.hefti has a spectacular aura about ingo.hefti has a spectacular aura about ingo.hefti has a spectacular aura about

      0  

    Default


    Did you make any progress on this? Just wondering because I remember once trying to do the same. Finally did my form posts with a simple ajax request...

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    4
    Vote Rating
    0
    sarah_iseli is on a distinguished road

      0  

    Default No progress with remoteProxy and FormPanel

    No progress with remoteProxy and FormPanel


    Unfortunately I couldn't do it the mentioned way. At the end I send the form as well with post directly to the url.

Thread Participants: 1

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