Results 1 to 3 of 3

Thread: Store Data with hasMany relation

  1. #1
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    12

    Default Store Data with hasMany relation

    Hi All

    I've been wandering if there was a shorter way to create data for a store than this :

    Code:
    var companyInput = Ext.create('Sapsales.model.sales.CompanyInputs',{
    	        	nbemployee:'2000',
    	        	ppw:'0.3',
    	        	awcs:'45000',
    	        	abcs:'45000',
    		});
    		
    		this.company = Ext.create('Sapsales.model.sales.Company',{
    			name: 'MyCompany',
    			
    		});
    		this.company.companyInput().add(companyInput);
    I know it might sound stupid but can I declare this in one go instead of doing the add ?

    I will soon be using json files instead, but for now I would like to know how to write the config to fill in the hasMany fields.

    Cheers
    Jason

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    Pretty much the only way. You could just pass the object in add, you don't have to create an instance of a model to pass into add.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    12

    Default



    I was wandering if there was a way to do something like :



    Code:
    this.company = Ext.create('Sapsales.model.sales.Company',{
                name: 'MyCompany', 
                companyInput:{
                            nbemployee:'2000',
                            ppw:'0.3', 
                            awcs:'45000',
                            abcs:'45000',
    });

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
  •