Results 1 to 2 of 2

Thread: [4.1.0]: The parameter 'operation' of the Store event 'load' is empty

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jun 2008
    Posts
    316
    Vote Rating
    24
      0  

    Default [4.1.0]: The parameter 'operation' of the Store event 'load' is empty

    REQUIRED INFORMATION

    Ext version tested:

    • Ext 4.1.0



    Browser versions tested against:

    • IE 9.0.8112.16421
    • FF 12.0, firebug 1.9.1
    • Opera 11.62
    • Chrome 18
    • Safari 5.1.5



    Description:

    • The parameter 'operation' of the Store event 'load' is empty

      load( Ext.data.store this, Array records, Boolean successful, Ext.data.Operation operation )

      Parameters

      this : Ext.data.store

    • records : Array
      An array of records

    • successful : Boolean
      True if the operation was successful.

    • operation : Ext.data.Operation
      The associated operation


    Steps to reproduce the problem:

    • Create a store with a load event handler
    • Load the store
    • Evaluate the parameter operation of the load event handler



    The result that was expected:

    • The parameter "operation" should not be empty



    The result that occurs instead:

    • The parameter "operation" is empty



    Test Case:

    HELPFUL INFORMATION

    Debugging already done:

    • Yes



    Possible fix:

    • The bug is just because one has forgotten to pass the paramter in the fireEvent method



    Current wrong code:

    Code:
        onProxyLoad: function(operation) {
            var me = this,
                resultSet = operation.getResultSet(),
                records = operation.getRecords(),
                successful = operation.wasSuccessful();
    
            if (resultSet) {
                me.totalCount = resultSet.total;
            }
    
            if (successful) {
                me.loadRecords(records, operation);
            }
    
            me.loading = false;
            me.fireEvent('load', me, records, successful);
    
            //TODO: deprecate this event, it should always have been 'load' instead. 'load' is now documented, 'read' is not.
            //People are definitely using this so can't deprecate safely until 2.x
            me.fireEvent('read', me, records, operation.wasSuccessful());
    
            //this is a callback that would have been passed to the 'read' function and is optional
            Ext.callback(operation.callback, operation.scope || me, [records, operation, successful]);
        },
    Correct code:

    Code:
        onProxyLoad: function(operation) {
            var me = this,
                resultSet = operation.getResultSet(),
                records = operation.getRecords(),
                successful = operation.wasSuccessful();
    
            if (resultSet) {
                me.totalCount = resultSet.total;
            }
    
            if (successful) {
                me.loadRecords(records, operation);
            }
    
            me.loading = false;
            me.fireEvent('load', me, records, successful, operation);
    
            //TODO: deprecate this event, it should always have been 'load' instead. 'load' is now documented, 'read' is not.
            //People are definitely using this so can't deprecate safely until 2.x
            me.fireEvent('read', me, records, operation.wasSuccessful());
    
            //this is a callback that would have been passed to the 'read' function and is optional
            Ext.callback(operation.callback, operation.scope || me, [records, operation, successful]);
        },
    Additional CSS used:

    • only default ext-all.css



    Operating System:

    • Windows 7

  2. #2
    Sencha User
    Join Date
    Jun 2008
    Posts
    316
    Vote Rating
    24
      0  

    Default

    The same for the TreeStore

    Code:
        onProxyLoad: function(operation) {
            var me = this,
                successful = operation.wasSuccessful(),
                records = operation.getRecords(),
                node = operation.node;
    
            me.loading = false;
            node.set('loading', false);
            if (successful) {
                records = me.fillNode(node, records);
            }
            // The load event has an extra node parameter
            // (differing from the load event described in AbstractStore)
            /**
             * @event load
             * Fires whenever the store reads data from a remote data source.
             * @param {Ext.data.TreeStore} this
             * @param {Ext.data.NodeInterface} node The node that was loaded.
             * @param {Ext.data.Model[]} records An array of records.
             * @param {Boolean} successful True if the operation was successful.
             */
            // deprecate read?
            me.fireEvent('read', me, operation.node, records, successful, operation);
            me.fireEvent('load', me, operation.node, records, successful, operation);
            //this is a callback that would have been passed to the 'read' function and is optional
            Ext.callback(operation.callback, operation.scope || me, [records, operation, successful]);
        }

Posting Permissions

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