1. #1
    Sencha User
    Join Date
    Mar 2009
    Posts
    10
    Vote Rating
    0
    wilderland is on a distinguished road

      0  

    Default looking for best practice dealing with empty Jsonstore

    looking for best practice dealing with empty Jsonstore


    Hello,

    I hope you can help me, i digged in the forum and the tutorial, but i didn't found a good example how I deal with a empty Json-Store.

    I my case I would like to react on a failure a the server, also the JSON brings his metadata for the store from the server. I set the successProperty. But at the moment I have to deal with the success by my own. How I read it is possible that the JSON-Store will react on this. Maybe I have some problems in the configuration or in understanding how it work.

    here the JSON-Stream

    Code:
    {
        "success": false,
        "errors": {
            "errornumber": 403,
            "errormessage": "Zugriff nicht erlaubt"
        },
        "metaData": {
            "totalProperty": "resultcount",
            "root": "Activities",
            "successProperty": "success",
            "message": "errors",
            "fields": [ 
    			{"name": "Activity.id"}, 
    			{"name": "Activity.user_id"}, .. some more fields ..
            ]
        },
        "resultcount": 0,
        "Activities": [
            
        ]
    }
    here the Class with deals with the JSON-Data

    Code:
    ActivityList =function(config){
    	this.StoreActivityList = new Ext.data.JsonStore({
    		autoLoad : true,
    		url : webRoot+'dashboard/activitylist.json',
    		listeners:{loadexception:function(a,request,response,error){
    				if(error instanceof Error) {
                  		var msg = "Error while processing server response: "+error.name+": "+error.message;
                  		Ext.Msg.alert('Fehler',msg);
                	}else{
                		alert(response);
                	}
    			},
    			load: function(store, records, options){
    				 var data = store.reader.jsonData;
    				  if(!data.success){
    				      alert(data.errors.errormessage);
    				  }
    			}
    		}
    	});
    	
    	var preConfig = {
    		store: this.StoreActivityList ,
    		viewConfig: {
    			forceFit: false
    		},
    		sm: new Ext.grid.RowSelectionModel({singleSelect:false}),
    		frame:true,
    		title:'aktuelle Alarme',
    		iconCls:'icon-grid',
    		region:'center',
    	};
    	
    	//config um fehlende Werte erweitern 	
    	if (config != null){
    		Ext.applyIf(config,preConfig);
    	}else{
    		config = preConfig;
    	}
    	
    	ActivityList.superclass.constructor.call(this, config);
    };
    
    Ext.extend(ActivityList, Ext.grid.GridPanel, {
    	info: function(){
    		//
    	}
    });
    My Question is: Why does the Store not react on success:false and how can I stop the processing in load-event?

    Thanks

  2. #2
    Ext User
    Join Date
    Jun 2009
    Posts
    18
    Vote Rating
    0
    dke01 is on a distinguished road

      0  

    Default Any answer

    Any answer


    Did you find any more information about this? As I am also interested in this.

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