1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    2
    Vote Rating
    0
    gollamudi is on a distinguished road

      0  

    Exclamation Unanswered: Grid panel - Sync functionality

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,645
    Answers
    3453
    Vote Rating
    816
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So what functionality do you currently have?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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
    gollamudi is on a distinguished road

      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

Thread Participants: 1

Tags for this Thread