Results 1 to 5 of 5

Thread: Erase model with writeAllFields in writer

    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha Premium Member ebett's Avatar
    Join Date
    Nov 2010
    Location
    Argentina
    Posts
    31

    Exclamation Erase model with writeAllFields in writer

    I have this error when I try to erase a model with writeAllFields:true.

    Uncaught RangeError: Maximum call stack size exceeded ext-all-debug.js:31545
    Ext.JSON.encodeString ext-all-debug.js:31545
    Ext.JSON.doEncode ext-all-debug.js:31512
    Ext.JSON.encodeObject ext-all-debug.js:31624
    Ext.JSON.doEncode ext-all-debug.js:31527
    Ext.JSON.encodeArray ext-all-debug.js:31603
    ...
    Code:
    Ext.define('App.model.PermissionOwner',{
        extend: 'Ext.data.Model',
        requires: ['App.common.data.proxy.AtsRestProxy'],
        idProperty: 'id',
        fields: [
            {
              name: 'id',
              type: 'int',
              useNull : true
            },
            'userLoginName',
            'lastAcquisitionDate'
        ],    
      
        proxy: {
            type: 'atsrest',
            pageParam: undefined,
            startParam: undefined,
            limitParam: undefined,
            url: siteConfig.restApiUrl + '/customers/{customer_id}/sites/{site_id}/PermissionOwner',
            reader: {
                type: 'json',
                rootProperty: 'data'
            },
            writer:{
                type:'json',        
                writeAllFields: true
            }
        }
    });
    The proxy "atsrest" replace {vars} in the URL with actual parameters:
    Code:
    permissionOwner.getProxy().setUriParams({
        customer_id: 12,
        site_id: 14
    });
    
    
    permissionOwner.erase({
        success : function(){
            ...
        }    
    });
    Any Idea?

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    It's hitting some recursive data when encoding the model. Can you post a test case that demonstrates the issue?
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha Premium Member ebett's Avatar
    Join Date
    Nov 2010
    Location
    Argentina
    Posts
    31

    Default

    For the moment, de model has this values
    Code:
    {"id":0,"userLoginName": "ADMIN","lastAcquisitionDate": "07/10/2014 02:44:30"}
    The bug is here, in the method "setOptions"of Ext.data.Connection class.
    Code:
     data = options.rawData || options.binaryData || options.xmlData || jsonData || null;
            if (jsonData && !Ext.isPrimitive(jsonData)) {
                data = Ext.encode(data);
            }

  4. #4
    Sencha Premium Member ebett's Avatar
    Join Date
    Nov 2010
    Location
    Argentina
    Posts
    31

    Default

    I suppose that with writeAllFields the Ext.encode function try to encode not only data but success and scope functions also.
    If I set writeAllFields to false, data only has id field without success and scope.

  5. #5
    Sencha Premium Member ebett's Avatar
    Join Date
    Nov 2010
    Location
    Argentina
    Posts
    31

    Default

    Code:
    App.model.PermissionOwner.load(0, {
        scope : me,
        success : function (record, operation) { 
    //this.permissionOwner = record; THIS WAS THE ERROR!!
    
    //I have to use raw data.
            this.permissionOwner = new App.model.PermissionOwner(record.raw);
        }
    });
    
    //Later...
    me.permissionOwner.erase({
        success : function () {
            ...
        }
    });

Tags for this Thread

Posting Permissions

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