1. #1
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    20
    Answers
    1
    Vote Rating
    0
    salorob is on a distinguished road

      0  

    Default Unanswered: Model with nested hasmany, empties child record on model.load(

    Unanswered: Model with nested hasmany, empties child record on model.load(


    Hi There,

    I've got an json file looking like so (snippet):
    Code:
    {
    • Key: 1,
    • Type: 1,
    • Description: "Cell 1",
    • Cell_Assignment: {
      • Product_Name: "Aardappelen",
      • Product_Tag: "potatoes",
      • Description: null
      },
    • Node_ID: "C44619BB298F",
    • Function_Assignments: [
      • {
        • Function: {
          • Key: 60001,
          • Tag: "mProdTemp1",
          • Name: "mProdTemp1"
          },
        • Type: 1,
        • Value: 0,
        • Set_By: "-1",
        • Set_Prio: -1,
        • DashboardVisible: true
        },
      • {
        • Function: {
          • Key: 60002,
          • Tag: "mProdTemp2",
          • Name: "mProdTemp2"
          },
        • Type: 0,
        • Value: 0,
        • Set_By: "-1",
        • Set_Prio: -1,
        • DashboardVisible: true
        },
    Parent record is called: ' Cell', and has an HasMany association with FunctionAssignments, wich on its turn has an HasOne association with Function.

    All works great, but now i want to refresh one specific record, so i started like so:

    Code:
    var cell = Ext.ModelMgr.getModel('EasyStoreApp.model.Cell');
    cell.load(this.getData().get('Key'),{
        success: function(loaded_cell) {
        
          console.log(loaded_cell);
          console.log(loaded_cell.FunctionAssignments().load());
          
          loaded_cell.FunctionAssignments().each(function(functionassignment) {
    
    
              var func = functionassignment.getFunction();
            console.log(func.get('Tag') + ':' + functionassignment.get('Value') + ':' + func.get('Error'));
    
    
          });
                                                 
        }
    });
    The parent record gets loaded, but the child records (array) is emptied, and not refilled. When i would choose to not run this load() command on the HasMany association:

    Code:
    loaded_cell.FunctionAssignments().load()
    It remains filled, but not with the newly retrieved values.

    Is there something to be done differently ?

    Regards,

  2. #2
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    20
    Answers
    1
    Vote Rating
    0
    salorob is on a distinguished road

      0  

    Default


    anybody ?

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    20
    Answers
    1
    Vote Rating
    0
    salorob is on a distinguished road

      0  

    Default


    Another thing i found out: when i just reload the store in its total with store.load(); , then the 'HasMany' records are not reloaded either!

    So from where im standing it looks like it only goes right, when the store gets loaded for the first time by the autoLoad property.

    Maybe that will clear things up a little ?

  4. #4
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    20
    Answers
    1
    Vote Rating
    0
    salorob is on a distinguished road

      0  

    Thumbs up Solved

    Solved


    This problem was solved, by sticking to a earlier version of Sencha Touch 2. The latest version of Sencha Touch still has this problem...

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."