Results 1 to 2 of 2

Thread: Gris store calling Twice

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

    Default Gris store 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 In Advance
    Kamalakar Reddy

  2. #2
    Sencha Premium Member
    Join Date
    Mar 2010
    Posts
    150
    Answers
    2
    Vote Rating
    19
      0  

Similar Threads

  1. Replies: 6
    Last Post: 2 Sep 2015, 1:10 PM
  2. Replies: 3
    Last Post: 8 Jan 2014, 6:39 AM
  3. [4.0.2a] Store not calling setModel
    By nextSTEP in forum Ext: Q&A
    Replies: 3
    Last Post: 31 Jan 2012, 7:49 AM
  4. Store keeps calling query
    By Wtower in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 28 Oct 2010, 4:20 AM
  5. 2 Gris into 2 tabs?
    By islem in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 18 Apr 2008, 6:36 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
  •