1. #1
    Sencha User fabiohcruz's Avatar
    Join Date
    Apr 2013
    Posts
    1
    Vote Rating
    0
    fabiohcruz is on a distinguished road

      0  

    Default Unanswered: Get value in PHP

    Unanswered: Get value in PHP


    Hello,

    Im not received the data in PHP.

    if proxy localstorage working correctly

    my model

    Ext.define('visitas.model.visitas', {
    extend: 'Ext.data.Model',

    config:{
    fields:[{name: 'cliente', type: 'string'},
    {name: 'dt', type: 'date'},
    {name: 'descricao', type: 'string'}
    ],
    proxy:{//type: 'localstorage', id:'listavisitas'

    type: 'rest',
    url: 'insert.php',
    id:'listavisitas',
    reader: {
    type: 'json'
    }
    },
    identifier: {type:'uuid'},
    validations: [{type:'presence',
    field:'cliente'},
    {type:'presence',
    field:'dt'
    }]
    }
    })

    my Store
    Ext.define('visitas.store.Listavisitas', {
    extend: 'Ext.data.Store',
    requires: ['visitas.model.visitas'],
    config:{
    model:'visitas.model.visitas',
    //data:[{nome:'nome teste', sobrenome:'sobrenome teste'}]

    autoLoad:true
    }
    })

    My controller
    Ext.define('visitas.controller.Cadastrovisitas',{
    extend: 'Ext.app.Controller',
    requires: ['visitas.view.ViewEditvisitas'],
    config:{
    control:{
    'button[action=adicionar-visitas]': {
    tap:'adicionar'
    },
    'edit-visitas button[action=salvar]':{
    tap:'salvar'
    },
    'edit-visitas button[action=cancelar]':{
    tap:'fecharEdicao'
    },
    'button[action=visitas-dia]':{
    tap:'visitasdia'
    },
    'lista-visitas':{
    select:'editar',
    deleteItem:'excluir'
    }
    },
    models:['visitas'],
    stores:['Listavisitas'],
    refs:{navigation:'navigationview',
    listavisitas:'lista-visitas'}
    },
    adicionar: function(){
    var me=this;
    var record=Ext.create('visitas.model.visitas', {nome: 'Novo visita'});
    var form=Ext.widget('edit-visitas', {title:'Adicionar visita'});
    form.setRecord(record);
    me.getNavigation().push(form);




    },

    salvar: function(){
    var me=this;
    var navigation=me.getNavigation();
    var form=navigation.getActiveItem();
    var record=form.getRecord();

    record.set(form.getValues());
    var store=Ext.getStore('Listavisitas');
    if(record.isValid()){
    if(record.stores.length==0){
    store.add(record);
    }
    store.sync();
    navigation.pop();




    //form.save();
    //Ext.Logger.log('teste');
    // user.save({success: function() {console.log('The User was updated');}});


    /*
    var store2 = Ext.getStore('ListavisitasServidor');
    var record2 = store2.getById(record.get('id'));
    record2.set(form.getValues());
    store2.sync( );
    */
    }
    else{
    Ext.Msg.alert('Atenção','Informações incompletas')
    }
    },

    fecharEdicao: function(){
    var me=this;
    var navigation=me.getNavigation();
    var form=navigation.getActiveItem();
    form.getRecord().reject();
    navigation.pop();
    },
    editar: function(){
    var me=this;
    var lista=me.getListavisitas();
    var record=lista.hasSelection() ? lista.getSelection()[0] : null;
    if(record==null){return;}

    var form=Ext.widget('edit-visitas', {title:'Editar visita'});
    form.setRecord(record);
    me.getNavigation().push(form);
    lista.deselectAll();

    },
    excluir: function(registro){
    var me=this;
    var store=Ext.getStore('Listavisitas');
    store.remove(registro);
    store.sync();

    },
    visitasdia: function(){
    /* var me=this;
    var record=Ext.create('visitas.model.visitas', {nome: 'Novo visita'});
    var form=Ext.widget('edit-visitas', {title:'Adicionar visita'});
    form.setRecord(record);
    me.getNavigation().push(form);*/
    Ext.Logger.log('teste');
    },

    })

    my view
    Ext.define('visitas.view.ViewEditvisitas',{
    extend: 'Ext.form.Panel',
    requires:['Ext.form.FieldSet','Ext.field.DatePicker'],
    xtype:'edit-visitas',
    config:{
    layout:'vbox',
    title:'Editar Contato',
    items:[
    {
    xtype:'fieldset',
    title:'Cliente',
    items:[
    {xtype:'textfield',
    label:'Nome',
    name:'cliente'
    }/*,
    {xtype:'textfield',
    label:'Sobrenome',
    name:'sobrenome'
    }*/
    ]
    }/*,
    {
    xtype:'fieldset',
    title:'Contato',
    items:[
    {xtype:'textfield',
    label:'Telefone',
    name:'telefone'
    },
    {xtype:'textfield',
    label:'Celular',
    name:'celular'
    }
    ]
    }*/,
    {
    xtype:'fieldset',
    title:'Informações',
    items:[
    {xtype:'datepickerfield',
    label:'Data da Visita',
    name:'dt',
    picker: { slotOrder : ['day', 'month', 'year'],value: new Date() }
    },/*
    {xtype:'Datetimepicker',
    label:'Data da Visita',
    name:'hora',

    },*/
    { xtype: 'textareafield',
    maxRows: 4,
    label:'Descrição',
    name:'descricao'
    }
    ]
    },
    {
    xtype:'button',
    text:'Salvar',
    margin:'0 0 20 0',
    action:'salvar',
    ui:'confirm'
    },
    {
    xtype:'button',
    text:'Cancelar',
    margin:'0 0 20 0',
    action:'cancelar'
    }

    ]
    },
    listeners:{
    painted: function(){
    var me=this;
    me.down('field').focus();
    }
    }


    })

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Answers
    3500
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Please use BBCode [CODE] tags. I gave up trying to read your code.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread