Results 1 to 3 of 3

Thread: success in save method

  1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    18
    Vote Rating
    0
      0  

    Default 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 vlidos', '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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    There is an open bug for this.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    18
    Vote Rating
    0
      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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •