1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    224
    Vote Rating
    9
    dedoz will become famous soon enough

      0  

    Default [4.1 beta 2 ] record.save() is not working ?

    [4.1 beta 2 ] record.save() is not working ?


    just asking before posting a bug
    using a trivial record.save() gives me an error

    Code:
    Ext.onReady(function() {
        Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);
        
        Ext.define('someModel', {
            extend: 'Ext.data.Model',
            fields: ['id','someField'],
            proxy: 
            {    type: 'direct',
                api:{ create    : carDefaultQuery.carInsert }
            }
        });
        
        
        var myRecord = Ext.create('someModel');
        myRecord.set('someField','some text');
        myRecord.save();
        
    });
    error comes from this library code
    Code:
    Ext.define('Ext.data.proxy.Direct', {
    ..........
        doRequest: function(operation, callback, scope) {
            var me = this,
                writer = me.getWriter(),
                request = me.buildRequest(operation, callback, scope),
                fn = me.api[request.action] || me.directFn,
                params = request.params,
                method,
                args;
    
            if (!fn) {
                Ext.Error.raise('No direct function specified for this proxy');
            }
            if (operation.allowWrite()) {
                request = writer.write(request);
            }
            if (operation.action == 'read') {
                // We need to pass params
                method = fn.directCfg.method;
                args = method.getArgs(params, me.paramOrder, me.paramsAsHash);
            } else {
                args.push(request.jsonData); <-- ERROR, args undefined
            }
            Ext.apply(request, {
                args: args,
                directFn: fn
            });
            args.push(me.createRequestCallback(request, operation, callback, scope), me);
            fn.apply(window, args);
        }, 
    ......
    if u look at this code, args never was initialized before the args.push that gives the error.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,997
    Vote Rating
    649
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    You're right, that should initialize the array. Thanks for the report.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    224
    Vote Rating
    9
    dedoz will become famous soon enough

      0  

    Default


    no problem but, to make my own fix while u guys release the beta 3

    where should i initialize the array ?
    just before the arg.push ? something like args = new Array() ?

Thread Participants: 1