Results 1 to 3 of 3

Thread: Grid panel - Sync functionality

  1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    2
    Vote Rating
    0
      0  

    Exclamation Unanswered: Grid panel - Sync functionality

    Hi,

    I am working on EXT JS 4 - MVC architecture.

    I have a Grid Panel whose store is as follows



    Code:
    Ext.require([
        'Ext.data.*'
    ]);
    
    
    Ext.define('TradeAdjustment.store.TradeAdjustmentGrid',{
    
    
    	extend:'Ext.data.Store',
    	autoLoad: true,
    	requires:'TradeAdjustment.model.TradeAdjustmentGridModel',
    	model:'TradeAdjustment.model.TradeAdjustmentGridModel',
    	pageSize: 50,
    	storeId: 'tradeAdjustmentGridID',
    	proxy: {
    		type:'ajax',
    		url: '/AdminTool/AdminToolServlet/TRADE_ADJUSTMENT?dispatchAction=list',
    		extraParams: {act:'load'},
    		reader: {
    			type : 'json',
    			root : 'tradeadjustmentgrid',
    			totalProperty: 'total'
    		},
    		writer: {
    		    	type: 'json',
    		    	writeAllFields : true,  //just send changed fields
    		    	allowSingle :false      //always wrap in an array
    		   	// nameProperty: 'mapping'
    		},
    		exception: function (proxy, response, operation) {
                        var json = Ext.decode(response.responseText);
                        console.log('STORE PROXY EXCEPTION');
                        if (json) {
                            
                        } else {
                        
                        }
                        
                    }
    	},
    	listeners : {
    		//exception: function(proxy, res) {
    		exception: function (proxy, res, operation) {
                        	var json = Ext.decode(res.responseText);
    			console.log(proxy);
    			//console.log(type);
    			var responseObj = Ext.JSON.decode(res.responseText);
    			var success = responseObj.success;
    
    
    			if(success == true)
    			{
    				console.log('SUCCESS');
    			}
    			else
    			{
    				console.log('FAILURE');
    			}
    		}
    	}
    });
    And my response after the GRID is sync is like this

    Code:
    {"success":"false","total":1,"tradeadjustmentgrid":[{"adjustmentTradeIndicator":"No","adjustmentType":"6","description":"Description0.5914142383874671","gainLossIndicator":"Yes","inputPrice":"Yes","requiresNotification":"No","tradeShareIndicator":"Yes"}]}
    The result can either be success: true - when all the records have successfully validated on client side
    or success:false - when error records are sent from server side.

    Can you please help me configure this requirement.

    Thanks
    Ravi

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    So what functionality do you currently have?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
    Jan 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default

    I have written exception listener on my store as well as proxy, but neither of them is getting called on the response.

    Can you gimme an example where my Modified records from store when sync'ed and sent to server for DB operations.

    Some of the records are saved successfully and some fail server side validation.

    I want to mark successfully saved records as background GREEN

    And server-side validation failed records as background RED

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •