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 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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Answers
    3976
    Vote Rating
    1381
      0  

    Default

    So what functionality do you currently have?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  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
  •