1. #1
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    64
    Answers
    6
    Vote Rating
    5
    AssetWorks is on a distinguished road

      0  

    Default Answered: store.add question

    Answered: store.add question


    The Question:
    How can I add an associated store to the model I added to the store.
    to understand the question better Let me show you what I have and you will see my problem

    I have a grid that has many combinations and each combination has many child data
    Code:
    <Combinations xmlns="">     
           <Combination>        
               <Desc></Desc>       
               <children>   
                    <child>           
                         <data1></data1>            
                         <data2></data2>            
                         <data3></data3>          
                    </child>          
                    <child>
                            <data1></data1>           
                            <data2></data2>            
                            <data3></data3>          
                      </child>        
              </children>      
              </Combination>      
                      ....(and so on)    
    </Combinations>
    my problem is not reading the data but when I want to add a combination that I build. I need to insert/add all that data to the store in the same structure as when I'm reading
    point being that if I do
    Code:
    store.add({Desc:  'New Combination'})
    assume I have data already in the store from the server and that New Combination is the combination I build and want to push it in the store.
    Now New combination has no associated store in it like the data that came back from the server.
    see screen shots of the console.log(store) after I build my comboCapture.PNG
    record 0,1&2 have the associated store to them but record 3 (the one That I build and added has no associated store to it

    how can I add this store to it or have be there when I add a record to it.
    I have all the data I just need to push it in there.

    any advise would be big help

  2. Actually I just blogged about this earlier today: http://mitchellsimoens.com/2013/03/e...-associations/ Could be a nice coincidence.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    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

      1  

    Default


    Actually I just blogged about this earlier today: http://mitchellsimoens.com/2013/03/e...-associations/ Could be a nice coincidence.
    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.

  4. #3
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    64
    Answers
    6
    Vote Rating
    5
    AssetWorks is on a distinguished road

      0  

    Default


    this is great just what I needed
    I had to do a store.add after creating the instance of the model.
    this added the model with the asscociation.
    I did not use store.loadRawData because my data is not JSON

    Code:
    var combo = Ext.create('Cam.model.CategoryCombinationModel', data, null, null, null, true);
    store.add(combo)

    on a side note: thanks for the link to your blog, very helpful stuff there

Thread Participants: 1

Tags for this Thread