1. #1
    Sencha User
    Join Date
    Oct 2010
    Location
    Brazil - MG, Belo Horizonte
    Posts
    62
    Answers
    4
    Vote Rating
    0
    wallynm is on a distinguished road

      0  

    Question Unanswered: How to post data?

    Unanswered: How to post data?


    Hey guys, i'm trying to update an grid, which form is inside an window. Here's my controller code which send the Ajax request:
    Code:
        updateUser: function(button) {
            var win    = button.up('window');
            var form   = win.down('form');
            var record = form.getRecord();
            var values = form.getValues();
            console.error(record, values)
            record.set(values);
            win.close();
            this.getTarefasTesteStore().sync()
        }
    Well, my problem here, it's because, .sync() send an ajax request, but i don't know how to get the data on the server, my store:

    Code:
    Ext.define('taskmag.store.TarefasTeste', {    extend: 'Ext.data.Store',
        model: 'taskmag.model.Tarefas',
        autoLoad: true,
        //autoSync: true,
        pageSize: 20,
        proxy: {
            method: 'POST',
            type: 'ajax',
            actionMethods: {read : 'POST'},
            api: {
                read: baseurl+'tarefas/listagem',
                update: baseurl+'tarefas/update'
            },
            
            reader: {
                type: 'json',
                root: 'rows',
                totalProperty: 'total'
            }
        }
    });
    I could pass all the data inside my form to the update URL?
    How i would pass it as POST data?


    My ajax send has an request payload, which is the row edited, i would like to get this data as post data...
    Code:
    Query String
        _dc: 1321966762541
    
    Request Payload
      {"codtarefa":"4","nometarefa":"Cadastro de sistema","codcriador":"1","codresponsavel":"1","datainicio":"11/26/2011","datacriacao":"11/26/2011","datafinalizacao":"11/26/2011","status":"4"}

  2. #2
    Sencha User
    Join Date
    Oct 2010
    Location
    Brazil - MG, Belo Horizonte
    Posts
    62
    Answers
    4
    Vote Rating
    0
    wallynm is on a distinguished road

      0  

    Default


    I have found an way to perform actions on the server, using Ajax request and submit on the form setting the url parameter, but i was wondering what the api config on the proxy definitions do in the system???

    Code:
    proxy: {
            idProperty: 'codtarefa',
            method: 'POST',
            type: 'ajax',
            actionMethods: {read : 'POST'},
            api: {
                read: baseurl+'tarefas/listagem',
                update :baseurl+'tarefas/listagem',
    }
    If i use store.sync() the update url it's called, but it don't send ANY POST data, so i cant update anything on the server, so, if it calling sync() method, what are the api purpose???

Tags for this Thread

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