1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    25
    Answers
    2
    Vote Rating
    0
    tmchedlishvili is on a distinguished road

      0  

    Default Unanswered: save new data in arraystore, add row

    Unanswered: save new data in arraystore, add row


    hello
    please help me or give me an advice
    my job is very easy but i can't efford to do this, this is my first foot steps in extjs.
    my goal is working save button,which saves new data and shows in grid
    my codes :
    two panel,(grid,panel)
    Code:
     Ext.define('SFG.view.PersonForm', {	extend: 'Ext.panel.Panel',
    requires : ['SFG.view.PersonGrid'],
    	alias: 'widget.personform',
    	title: 'ახალი მომხმარებელი',
    	 layout:'anchor',
    	 defaultType:'button',
    	autoShow: true,
    	//layout: 'column',
    	height: 220,
    	width: 60,
    
    
    	initComponent: function() {
    		var me = this;
        	me.buildItems(); 
    		me.callParent();
    	},
    buildItems : function()
    {
    	me=this;
    	items=[];
    	  items.push({ 
    	  	id:'aaa',
       			fieldLabel:'სახელი',
             xtype: 'textfield',
                 name:'name'
       		});			
      				
    	 items.push({ 
    	 	padding:10,
       			xtype: 'textfield',
       			
       			fieldLabel:'გვარი',
                name:'lastname'
       		});			 			
    	 items.push({ 
    	 	padding:10,
       			fieldLabel:'ასაკი',
                xtype:'numberfield',
                name:'age'
       		});			  			
    	 items.push({ 
    	 	padding:10,
       			fieldLabel:'სქესი',
                name:'gender',
                xtype:'combobox',
                displayField:'name',
                store:Ext.create('Ext.data.Store', {
                    fields:['name'],
                    data:[
                        {"name":"ქალი"},
                        {"name":"კაცი"}
                       
                    ]
                })
       		});			
       			
    	 items.push({ 
    	 	padding:10,
       			 fieldLabel:'დაბადების თარიღი',
                xtype:'datefield',
                name:'birthdate'
       		});			
       			
       		 items.push({
       		 	padding:10, 
     text: 'Reset',
                    handler: function () { 
                    	me= this;
                       me.up('personform').getForm().reset();	
                       }		
       					});			
    							  					   					
       			 items.push({	
      			 		   					
       		text:'Save',
    				     
    							//scope:me,
    				            handler:function () {
    				            	me =this;
    		            					      
    //*******************************
    // i whant code here...
    				
    				}			
       				  					
       					});		
    	
    	me.items=items;
    	
    }
    
    
    });
    my grid :
    Code:
    Ext.define('SFG.view.PersonGrid', {
    	extend : 'Ext.grid.Panel',
    	//requires: ['SFG.view.PersonForm','SFG.view.PersonForm'],
    	requires : ['SFG.store.History'],
    	alias : 'widget.persongrid',
    	title : 'მომხმარებლების მონაცემები',
    	height : 300,
    	width : 400,
    
    
    	initComponent : function() {
    		var me = this;
    		me.buildColumns();
    		me.buildStore();
    		me.callParent();
    	},
    
    
    	buildStore : function() {
    		var me = this;
    		 store = Ext.create('SFG.store.History');
    		me.store = store;
    	},
    
    
    	buildColumns : function() {
    		var me = this;
    		var columns = [];
    
    
    		columns.push({
    
    
    			text : 'Name',
    			flex : 1,
    
    
    			dataIndex : 'name',
    
    
    		});
    
    
    		columns.push({
    
    
    			text : 'lastname',
    			flex : 1,
    
    
    			dataIndex : 'lastname',
    
    
    		});
    
    
    		columns.push({
    			text : 'age',
    			flex : 1,
    
    
    			dataIndex : 'age',
    
    
    		});
    
    
    		columns.push({
    			text : 'gender',
    			flex : 1,
    
    
    			dataIndex : 'gender'
    
    
    		});
    
    
    		columns.push({
    			flex : 1,
    			text : 'დაბადების თარიღი',
    			xtype : 'datecolumn',
    
    
    			dataIndex : 'birthdate',
    			format : 'm-d-Y'
    
    
    		});
    
    
    		me.columns = columns;
    	}
    });
    my store and model
    Code:
    Ext.define('SFG.store.History', {
    	extend: 'Ext.data.Store',
    	model: 'SFG.model.History',
    	proxy: {
    		type: 'memory',
    		reader: {
    			type: 'json'
    		}
    	},
    	
    
    
    
    
    	        data:[
    	            {
    	              
    	                name:'s',
    	                lastname:'ss', 
    	                age:19,
    	             
    	                gender:'ქალი',
    	                birthdate:'08/08/2013'
    	          
    	             
    				}
    	           
    	        ]
    	
    	});


    and
    Code:
    Ext.define('SFG.model.History', {
    	extend: 'Ext.data.Model',
    	 fields:[
    	            'name', 'lastname' ,'gender',
    	           
    	            {name:'age', type:'int' },
    	          
    	           
    	            'birthdate'
    	        ]	
    });
    my viewport
    Code:
     Ext.define('SFG.view.Viewport', {	extend: 'Ext.container.Viewport',
    	requires: ['SFG.view.PersonGrid','SFG.view.PersonForm'],
    	layout: 'border',
    	
    	initComponent: function() {
    		var me = this;
    		me.buildItems();
    		me.callParent();
    	},
    	
    	buildItems: function() {
    		var me = this;
    		var items = [];
    		
    		items.push({
    			xtype: 'personform',
    			region: 'north',
    			height: 400,
    		}, {
    			xtype: 'persongrid',
    			region: 'center'
    		})
    my be it is strange but i can't do save button..
    please help me
    thnks

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,818
    Answers
    453
    Vote Rating
    608
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Please don't post questions in the bug forum. Moved to Q&A.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Jun 2013
    Posts
    25
    Answers
    2
    Vote Rating
    0
    tmchedlishvili is on a distinguished road

      0  

    Default


    thanks and sorry

  4. #4
    Sencha User
    Join Date
    Jun 2013
    Posts
    25
    Answers
    2
    Vote Rating
    0
    tmchedlishvili is on a distinguished road

      0  

    Default


    no one know about this...

  5. #5
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,913
    Answers
    371
    Vote Rating
    179
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    Have you seen this example?
    http://docs.sencha.com/extjs/4.2.1/e...er/writer.html

    It has a create button that once the form is filled in saves the form data to the grid below. Seems like that's what you're looking for.
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

  6. #6
    Sencha User
    Join Date
    Jun 2013
    Posts
    25
    Answers
    2
    Vote Rating
    0
    tmchedlishvili is on a distinguished road

      0  

    Default


    yes of course i saw but...may be it is fault of my knowledge in extjs
    finaly i do my job with this code :
    Code:
    t.up().down('persongrid').getStore().loadData(t.activeRecord[0].data, true); 

    inf onsave hendler

Thread Participants: 2

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