1. #1
    Ext User guys2008's Avatar
    Join Date
    Jul 2008
    Posts
    104
    Vote Rating
    0
    guys2008 is on a distinguished road

      0  

    Question success param in callback from store.load is false

    success param in callback from store.load is false


    Hello,
    I'm trying to fetch some JSON data from a php file, but every time load is invoked I get !success value in my call back function and data is not displayed in the grid. I've checked the returned JSON with JSLint and it's good. Anyone knows what I miss here ?? Or alternatively, anyone knows how can I get more information about what's behind the !success value ? (error text or smtng ...)

    Thanks !

    Here is my code :
    Code:
    	    var bottomStore = new Ext.data.Store({
    	    	baseParams:{uid:user_id},
    	        proxy: 
    		        new Ext.data.HttpProxy({url: 'fetchStatuses.php'}),
    
    	        reader: new Ext.data.JsonReader({
    	            root: 'rows',
    	            totalProperty: 'count',
    	            id: 'status_id',
    	            fields: ['status_id','keyword','uid','name','status','timestamp']
    	        }),
    	
    	        // turn off remote sorting
    	        remoteSort: false
    	    });
    	    
    		var bottomCm = new Ext.grid.ColumnModel([{
    	           dataIndex: 'status_id',
    			   hidden:true
    	        },{
    	           dataIndex: 'keyword',
    	           header:'Keyword',
    	           width: 65
    	        },{
    	           dataIndex: 'uid',
    			   hidden:true	           
    	        },{
    	           dataIndex: 'name',
    	           header:'Publisher',
    	           width: 120
    	        },{
    	           dataIndex: 'status',
    	           header:'Status Posted',
    	           width: 400
    	        },{
    	           dataIndex: 'timestamp',
    	           header:'Date & Time',
    	           width: 150
    //	           renderer: renderDate
    	        }
    		]);
    
    		var bottomGrid = new Ext.grid.GridPanel ({
    			id:'status-grid',
    	        width:720,
    	        height:180,
    	        renderTo: 'bottom-grid',
    	        iconCls: 'icon-grid',
    	        store: bottomStore,
    	        cm: bottomCm,
    	        frame:true,
    	        trackMouseOver:true,
    	        sm: new Ext.grid.RowSelectionModel({singleSelect: true}),     
    	        loadMask: true,   
    	        bbar: new Ext.PagingToolbar({
    	            pageSize: 5,
    	            store: bottomStore,
    	            emptyMsg: "No topics to display",
    	            items:[
    	                '-'
    	            ]
    	        })
    	    });
    	    bottomStore.load({params:{start:0, limit:5},
    
    	        callback: function(r,options,success){
    				if (!success)	 	    
    	 	        	Ext.Msg.show({
    	 	                title: 'Bottom Store Load Callback',
    	 	                msg: 'Unsuccessful load to bottomStore!',
    	 	                modal: false,
    	 	                icon: Ext.Msg.INFO,
    	 	                buttons: Ext.Msg.OK						
    					});
    
    	        }
    	    });
    Guys

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    So it's failing.

    Add an exception listener to your store.

    But also, show the JSON from the Firebug console. It probably doesn't match what the Reader is expecting.

  3. #3
    Ext User guys2008's Avatar
    Join Date
    Jul 2008
    Posts
    104
    Vote Rating
    0
    guys2008 is on a distinguished road

      0  

    Default


    Thanks. I didn't remove any '\n' characters from the JSON...
    Now it's fine. Thanks again!
    Guys

  4. #4
    Sencha User
    Join Date
    Jun 2011
    Location
    Colorado Springs, CO
    Posts
    3
    Vote Rating
    0
    jmiremba is on a distinguished road

      0  

    Default


    The "invisble" newline characters were the problem for me too. The original file can be seen here: http://extjsinaction.com/dataQuery.php. If saved, this file contains some strange (newline or other) characters that a casual regex parse (say, in Perl) does not catch.

Similar Threads

  1. Ext.form.FormPanel load() JSON success false
    By eliezerreis in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 28 Jan 2011, 2:10 AM
  2. Replies: 4
    Last Post: 14 Oct 2009, 8:42 PM
  3. Replies: 1
    Last Post: 12 Nov 2008, 7:00 AM
  4. Store.load callback triggering before load finishes
    By clockwork in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 15 Aug 2008, 12:15 PM

Thread Participants: 2