1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Milano
    Posts
    98
    Vote Rating
    0
    grubby69 is on a distinguished road

      0  

    Default Error on Ext.JSON.encode "Uncaught RangeError: Maximum call stack size exceeded"

    Error on Ext.JSON.encode "Uncaught RangeError: Maximum call stack size exceeded"


    Hello!

    I receive this error :

    "Uncaught RangeError: Maximum call stack size exceeded"

    when I am trying to encode an array of records of a model data.

    This is the code :

    Code:
    Ext.define('nuovaFattura', {
                extend: 'Ext.data.Model',
                fields: [
                    {name: 'IQTA', type: 'int'},
                    {name: 'VCODICE',  type: 'string'},
                ]
            });
            
    var nuovaFatturaStore = Ext.create('Ext.data.Store', {
               model: 'nuovaFattura',
               data: {'items':[
                    {"IQTA":"1", "VCODICE":"Clicca per inserire codice"}
                ]},
                proxy: {
                    type: 'memory',
                    reader: {
                        type: 'json',
                        root: 'items'
                    }
                }
       });
    
    .
    .
    .
    .
    .
    xtype: 'button',
    text: 'Aggiungi',
    handler: function() {
                                                                                        var rec = new nuovaFattura({
                                                                                                    IQTA: 1,
                                                                                                    VCODICE: 'Clicca per inserire codice'
            });
            nuovaFatturaStore.insert(0, rec);
    }
    
    .
    .
    .
    .
    .
    records = nuovaFatturaStore.getRange();
    jsonRecords = Ext.JSON.encode(records);

    So first I define the model,after the store ,in local mode,and after I fill the store with some data.

    Then I take all the records of the store by the getRange() and I have an array of model (the records)

    When I try to encode this array i receive the error!!!!

    Why???

    I have seen a report bug on this error but I have already download and using the ext-4.0.7 version!!!(that could be fixed with the error...),but the error persist......

    Why???
    It's a mine error or what????

    Please help...

    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Vote Rating
    752
    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


    The bug report you say you saw... did it say it was fixed?

    Also, you are going to have a lot of overhead when encoding an Array of Models... Don't you just want to encode the data Object of each Model?
    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
    Aug 2011
    Location
    Milano
    Posts
    98
    Vote Rating
    0
    grubby69 is on a distinguished road

      0  

    Default


    Hi!!!!

    Yes it say fixed I think...
    here : http://www.sencha.com/forum/showthre...exceeded/page3

    I dowload tha 4.0.7 and it say fixed in the 4.0.6 ....


    And yes ,I have many of this error :

    Code:
    "Uncaught RangeError: Maximum call stack size exceeded 
    encodeString
    doEncode
    encodeObject
    doEncode
    encodeObject
    doEncode
    encodeObject
    doEncode"
    And Yes!I want to
    encode the data Object of each Model!
    It is not right to do in my way???

    Now I have resolved doing this :

    Code:
    records = nuovaFatturaStore.getRange();
                                                                        
    jsonRecords = '';
    for(x=0;x<records.length;x++){
        jsonRecords = jsonRecords+Ext.JSON.encode(records[x].data)+',';
    }
    and sending the string encoded by AJAX to the php server where I decode and rebuild the array of objects.

    Is there another way?

    Thanks a lot and sorry...I am really new to Sencha.

    Regards

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Vote Rating
    752
    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


    Right now you are encoding the Model not the data so you have fields, there is a store reference that is then getting encoded. You need to loop through that array and add the data object to another array and encode that array.
    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.

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Location
    Milano
    Posts
    98
    Vote Rating
    0
    grubby69 is on a distinguished road

      0  

    Default


    Mmmm...sorry I don't understand....

    Could you explain more?
    Could you give me an example???


    Thanks a lot!!!

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Vote Rating
    752
    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


    Thought that was pretty good.

    So you have an array of Models... you have to loop through it:

    Code:
    var models = store.getRange(),
        m      = 0,
        mNum   = models.length;
    
    for (; m < mNum; m++) {
        ...
    }
    But you only want the data property:

    Code:
    var models = store.getRange(),
        m      = 0,
        mNum   = models.length,
        data   = [];
    
    for (; m < mNum; m++) {
        data.push(models[m].data);
    }
    Now the data array is an array of Objects that you would want to encode.
    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.

  7. #7
    Sencha User
    Join Date
    Aug 2011
    Location
    Milano
    Posts
    98
    Vote Rating
    0
    grubby69 is on a distinguished road

      0  

    Default


    Hi mitchell!!!
    Now I understand!

    Doing your way is more CLEAN.
    I was doing the encode of every records of the model array and after pass the string to the server I rebuild it in a correct JSON format and after decoded it.

    But your way is more simple.I will use it!!!


    Code:
    records = nuovaFatturaStore.getRange();
    
    
    dataArray = [];
    for(x=0;x<records.length;x++){
        dataArray.push(records[x].data);
    }
    jsonRecords = Ext.JSON.encode(dataArray);
    So thanks a lot about this solution!

    But how about the error I have talked up???It is fixed or will be?
    Should be possible to do the encode of the model's array or not?

    Really thanks a lot and I want to say Merry Christmas and a Happy New Year to you and all the Sencha Team!!!

    Bye

  8. #8
    Sencha User
    Join Date
    May 2011
    Location
    Argentina
    Posts
    54
    Vote Rating
    0
    ferengidedalo is on a distinguished road

      0  

    Default


    I think you can achieve the same result using:

    Ext.pluck(store.data.items, 'data');

  9. #9
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    9
    Vote Rating
    3
    megaurav2002 is on a distinguished road

      0  

    Default


    Ext.pluck is deprecated

  10. #10
    Sencha Premium Member
    Join Date
    Dec 2013
    Posts
    19
    Vote Rating
    0
    jstricker is on a distinguished road

      0  

    Default


    Ext.pluck() is deprecated, but Ext.Array.pluck() is not (at least, not as of Ext 4.2.2).

    http://docs.sencha.com/extjs/4.2.2/#...y-method-pluck

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar