1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    47
    Answers
    3
    Vote Rating
    0
    romulus2012 is on a distinguished road

      0  

    Default Unanswered: MVC application and CRUD from Form

    Unanswered: MVC application and CRUD from Form


    Hi,

    I'm working on an MVC structured application and i have to do some CRUD operations (add, remove and update).

    I have successfully loaded my datas from the local JSON and i can show them into fields in a form. But i don't know how to do CRUD operations using the proxy, store and model.

    Here is my code :

    Model file : Prospect.js

    Code:
    Ext.define('pharmapp.model.Prospect', {
        extend: 'Ext.data.Model',
        config: {
            fields: [
    			'nom', 
    			'prenom', 
    			'adresse', 
    			'email', 
    			'telephone', 
    			'datenaissance', 
    			'enfants', 
    			'conjoint', 
    			'cv', 
    			'autre', 
    			'profilage',
    			'secteur',
    			'region',
    			'specialite',
    			'grade'		
    			]
        },
    
    
    });

    Store file : Prospects.js

    Code:
    Ext.define('pharmapp.store.Prospects', {
        extend: 'Ext.data.Store',
        
        config: {
            model: 'pharmapp.model.Prospect',
            sorters: 'nom',
            grouper : function(record) {
                return record.get('prenom')[0];
            },
    	    autoLoad: true,
            proxy:{
    			type: 'rest',
    			url: 'app/data/prospects.json',
    	
    			reader:
    			{
    				type: 'json'
    			}
    	   }
        }
    });
    and i have a controller file Prospects.js that's supposed doing the actions mentioned above.


    Thanks for your help

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    Vote Rating
    834
    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


    Since you are using a store, if you add, update or remove a record from the store you can call sync() on the store and with a writer it will send a request to the server describing this change
    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
    Mar 2012
    Posts
    47
    Answers
    3
    Vote Rating
    0
    romulus2012 is on a distinguished road

      0  

    Default


    my problem is that i don't know how to pass information to the store from the controller. the only examples that i found describes how to do it in other ways and not MVC.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    Vote Rating
    834
    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 only hard part is resolving the store. And that depends on how your app is architected.
    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.

Thread Participants: 1

Tags for this Thread

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..." hd porno faketaxi