1. #1
    Ext User
    Join Date
    Dec 2007
    Posts
    5
    Vote Rating
    0
    strato1986 is on a distinguished road

      0  

    Exclamation JsonStore and successProperty :@

    JsonStore and successProperty :@


    Im having real troubles to get this working.. if i delete a record it fires the "write" event!
    but when i "add" or "insert" it doesnt! and i need to be able to read the successProperty result... here i leave the code and the json result when im adding a record...

    Code:
    var reader = new Ext.data.JsonReader(
    	{
        totalProperty: 'total',
        idProperty: 'idGrupo',
        root: 'datos'
    	}, 
    	[{name: 'idGrupo'},
        {name: 'nombreGrupo', allowBlank: false},
    	{name: 'cantidadUsuarios'},
        ]);
    
    var RecGrupo = Ext.data.Record.create(['nombreGrupo']);
    
    
    var writer = new Ext.data.JsonWriter({
    	encode: true,
    	writeAllFields: false
    });
    
    
    var store = new Ext.data.Store({
    	id		: 'grupos-store',
    	autoLoad : false,
    	autoSave : true,
    	restful : true,
    	proxy	: new Ext.data.HttpProxy({
    		url			:'index.php/grupos_rest/grupos/format/json',
    		listeners	: {
    				write : function(store, action, result, response, rs) {
    		            alert(response.success, response.message);
    					
    		        }
    					}
    		}),
    	reader	: reader,
    	writer	: writer,
    	listeners	: {
    		add		: function(store,record,index){
    		
    		},
    	}
    });
    
    
    
    var grid = new Ext.grid.EditorGridPanel({
    	id			: 'grupos-grid',
    	store		: store,
    	viewConfig: {forceFit: true},
    	columns 	: [	{header: 'Nombre del Grupo',dataIndex:'nombreGrupo'},
    				{header: 'Cantidad de Usuarios',dataIndex:'cantidadUsuarios'}],
    	height		: 300,
    	sm			: new Ext.grid.RowSelectionModel({singleSelect:true}),
    	tbar		: [{
    		text	: 'Agregar Grupo',
    		iconCls	: 'silk-group-add',
    		scope	: this,
    		handler	: function(){
    			Ext.Msg.prompt('Grupo','Ingrese el nombre del nuevo grupo:',function(btn,texto){
    				if (btn=="ok"){
    					if (Ext.util.Format.trim(texto) == ""){
    						alert("no puede estar vacio.")
    					} else {
    						//CREATE RECORD
    						var grid = Ext.getCmp('grupos-grid');
    						var g = new RecGrupo({"nombreGrupo" : texto});
    						grid.getStore().add(g);
    						
    					}
    				}
    			})
    		}
    	},{
    		text	: 'Eliminar Grupo',
    		iconCls	: 'silk-group-delete',
    		scope	: this,
    		handler	: function(){
    			var grid = Ext.getCmp('grupos-grid');
    			var rec = grid.getSelectionModel().getSelected();
    			if (!rec) {
    	            return false;
    	        }
    	        grid.store.remove(rec);
    			
    		}
    	},{
    		text	: 'Refrescar Datos',
    		iconCls	: 'silk-arrow-refresh',
    		scope	: this,
    		handler	: function(){
    			Ext.getCmp('grupos-grid').store.reload();
    		}
    	}]
    });
    
    grid.relayEvents(this.store, ['destroy', 'save', 'update']);
    and the json result...
    Code:
    {"success":true,"message":"Ok!"}
    but when i add a record it doesnot fire the "write" event... someone knows why this happens?

    sorry for my lousy english :P

  2. #2
    Ext User
    Join Date
    Jan 2008
    Posts
    4
    Vote Rating
    0
    johnd2i is on a distinguished road

      0  

    Default adding a record

    adding a record


    Adding a record will not fire the write event. Rather it will fire the add event on the store.

Thread Participants: 1

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