Results 1 to 3 of 3

Thread: Grid URL calling Twice

  1. #1
    Sencha User
    Join Date
    May 2013
    Posts
    99
    Vote Rating
    -2
      -1  

    Default Grid URL calling Twice

    Hi,
    We are using the Extjs 6.2.1.
    Am facing an issue with grid. Whenever am loading the grid URL fires twice in that one is with empty response and second one is with correct response.
    Why this is happening in jy case.
    Here is my code.
    Please help me in this.

    Code:
    //Grid
    {
    	xtype: 'da_grid',
    	width:'100%',
    	flex:1,
    	scrollable: true,
    	bind: {
    		store: '{alerts}'
    	},
    	emptyText: '<div class="C_info" style="margin:10px;">' + locale.getConfigs(agentlandinglocale).EMPTY_TEXT + '</div>',
    	columns: [
    	{
    	   flex:1,
    	   menuDisabled:true,
    	   renderer:function(value, metaData, record){
    		 
    		   if(record.data!== undefined){
    			   var key = record.data.appId+"_"+record.data.reminderMessage;
    			   var policyNo = '<html><font style = "color:#00529c;">'+record.data.referenceId+'</font></html>';
    			   var message = locale.getConfigs(agentlandinglocale)[key];
    			   if(record.data.appId === "AG"){
    				var messageData = (record.data.messageParameters).split(',');
    				var msgDate = (messageData[0].split(':'))[1];
    				var notificationDate = '<html><font style = "color:#00529c;">'+Ext.Date.format(new Date(msgDate),'d-m-Y')+'</font></html>';
    				var plan = '<html><font style = "color:#00529c;">'+(messageData[1].split(':'))[1]+'</font></html>';
    				message = Ext.String.format( message, policyNo, notificationDate, plan);
    			   }
    			 
    			   return '<html><span class="alertdataitemcls"><span style = "font-weight:500; white-space:normal !important;cursor:pointer;"><strong>'+message+'</strong></span></span></html>';
    		   }
    	   }
       }],  
    	bbar: {
    		xtype: 'pagingtoolbar',
    		displayInfo: true,
    		margin:'0 0 0 -18',
    		width:'98%',
    		displayMsg: '',
    		emptyMsg: "",
    		listeners:{
    			beforechange: 'beforeChangePage'
    		}
    	},
       listeners:{
    		afterrender : 'loadAlerts'
    	}
    }
    
    
    
    
    //Loading the grid
    loadAlerts : function(){
    	  var _this = this,
    	  	  alertStore = _this.getView().getViewModel().getStore('alerts');
    	  if(alertStore){
    			  var req = {
    						"role" : "AG",
    						"alertType" : "PolicyAlerts",
    						"alertName" : (this.alertName!=null)? this.alertName : "MATURITY_POLICY,RENEWAL_POLICY,LAPSE_POLICY"
    				};
    		  util.restartTimer(_this);
    		  var  url = configUrl.common.ID_ALERT_REMINDERS;
    		  if(alertStore.getProxy().getHeaders())alertStore.getProxy().getHeaders().Authorization = DigitalSuite.util.UserInfoFactory.getWebToken();	
    		  alertStore.getProxy().setUrl(url);
    		  alertStore.getProxy().setExtraParams(req);
    		  alertStore.removeAll();
    		  alertStore.load();
    	  }
      },
      
      
      
     //ViewModel
    Ext.define('AgentLanding.view.alerts.AlertsModel', {
        extend: 'Ext.app.ViewModel',
    	alias: 'viewmodel.alerts',
        requires: [
            'AgentLanding.model.alerts.Alert',
            'AgentLanding.model.alerts.Reminder'
        ],
        data:{
        	agentNotifications:0,
        	agentReminders : 0,
        	agentAlerts : 0
        },
        stores: {
        	alerts: {
        		pageSize: AG_POLICY_ALERT_PAGE_LIMIT,
    	 	  	model: 'AgentLanding.model.alerts.Reminder',
                proxy: {
                    type: 'rest',
                    timeout : 120000,
                    headers:{
    					  'Content-Type': 'application/json',
    					  'LOCALE': DigitalSuite.util.UserInfoFactory.getUserLocale()	  
                	},
                    reader: {
                        type: 'json',
                        rootProperty: 'actionableReminder',
                        totalProperty : 'count'
                    }
                },
                filters:[{
                	filterFn: function(record) {
                		return record.data.reminderMessage !== "BIRTHDAY";
                	}
                }
                ],
                listeners: {
                    load: 'alertsOnLoad',
                    beforeLoad:'beforeAlertsLoad'
                }
            }
        }
    });
    Thanks
    Kamalakar

  2. #2
    Sencha User
    Join Date
    Apr 2013
    Posts
    865
    Answers
    105
    Vote Rating
    171
      0  

    Default

    Are you doing cross-origin requests (CORS)?

  3. #3
    Sencha User
    Join Date
    May 2013
    Posts
    99
    Vote Rating
    -2
      -1  

    Default

    Thanks for you replay.
    No we are not using CORS.
    We are hitting the server with in the same domain only.

    Thanks
    Kamalakar

Similar Threads

  1. Replies: 1
    Last Post: 18 Feb 2014, 6:49 AM
  2. Replies: 3
    Last Post: 8 Jan 2014, 6:39 AM
  3. Replies: 3
    Last Post: 27 Sep 2011, 1:10 PM
  4. Replies: 3
    Last Post: 1 May 2007, 2:38 AM

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
  •