1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    18
    Vote Rating
    0
    lobosan is on a distinguished road

      0  

    Default Unanswered: success in save method

    Unanswered: success in save method


    Hi, i'm trying to retrieve a message when the data is successfully saved in a form or when it went wrong, but these callbacks aren't executed

    I followed the instructions of this page
    http://docs.sencha.com/ext-js/4-0/#!/guide/forms

    Here is the code of the form and the model
    Code:
    Ext.define('sisconse.view.FichaSenagua', {
        extend: 'sisconse.view.ui.FichaSenagua',
    
        initComponent: function() {
            var me = this;
            me.callParent(arguments);
    
            Ext.define('Ficha', {
                extend: 'Ext.data.Model',
                fields: ['con_id', 'con_formulario', 'con_responsable_datos'],
                proxy: {
                    type: 'ajax',
                    api: {
                        read: 'app/data/loadform.php',
                        create: 'app/data/updateform.php',
                        update: 'app/data/updateform.php'
                    },
                    reader: {
                        type: 'json',
                        root: 'data'
                    },
                    writer: {
                        type: 'json',
                        root: 'data',
                        encode: true
                    }
                }
            });
    
            var numficha = Ext.urlDecode(window.location.search.substring("ficha"));
    
            Ext.ModelMgr.getModel('Ficha').load(numficha, {
                //waitMsg: 'Cargando...',
                success: function(idficha) {
                    me.getForm().loadRecord(idficha);
                }
            });
        }
    });
    And here the code of the button that handles the save action
    Code:
    Ext.define('sisconse.view.BtnGuardar', {
        extend: 'sisconse.view.ui.BtnGuardar',
        alias: 'widget.btnguardar',
    
        initComponent: function() {
            var me = this;
            me.callParent(arguments);
    
            me.on('click', function() {
                var form = this.up('form').getForm();
                var record = form.getRecord();
                if(form.isValid()) {
                    form.updateRecord(record);
                    record.save({
                        success: function(idficha) {
                            Ext.Msg.alert('Éxito', 'Ficha guardada exitosamente.')
                        },
                        failure: function(idficha) {
                            Ext.Msg.alert('Error', 'Hubo un error al guardar los datos.')
                        }
                    });
                } else {
                    Ext.Msg.alert('Datos no válidos', 'Por favor corrija los errores.')
                }
            });
        }
    });
    And the response from the server when the data was saved
    Code:
    {"success":true,"msg":"Ficha actualizada exitosamente"}
    But the success property is never executed and i can't see any message alert

    Thanks in advance for any help

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,206
    Answers
    3517
    Vote Rating
    856
    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


    There is an open bug for this.
    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.

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    18
    Vote Rating
    0
    lobosan is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    There is an open bug for this.
    It's gonna be solved in next stable version? and when it is gonna be available?

Thread Participants: 1