Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: # [CLOSED-471723] Why update event is handler many times on Ext.data.Store ?

  1. #11
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638

    Default

    Two things:
    • Put your code in the CODE tag next time.
    • Mark this thread as [SOLVED] or [CLOSED] by prefixing the original post title (Edit Post/Go Advanced/Edit the Title)

  2. #12

    Default

    Ok, I used the code tag and closed, thx again four your help, here is the entire solution

    Code:
     
    
    var cmList = new Ext.grid.ColumnModel({
            columns: [
                      {header: "serviceName", dataIndex: "serviceName"}
                      ]        
           });
    
     
        
        var usersListStore = new Ext.data.Store({
            url: '<c:url value="/comref/jsonSybilUsers.do"/>',
           
    
            reader: new Ext.data.JsonReader({
                   root: 'users',
                   id: 'id',
                   autoSave: false, 
                   totalRecords: 'rows',
                   totalProperty: 'rows'      
                       
                       
               }, [
                   {name: 'id', mapping: 'id'},
                   {name: 'userFirstName', mapping: 'userFirstName'},
                   {name: 'userLastName', mapping: 'userLastName'},
                   {name: 'userLogin', mapping: 'userLogin'},
                  // {name: 'userEmail', mapping: 'userEmail'},
                   {name: 'userNotificationFlag', mapping: 'userNotificationFlag'}
               ]
    
               ),
    
               listeners: { 
                    update: function(store,record, operation){
                    
                      var url = '<c:url value="/comref/jsonSybilUsers.do"/>';
                      var idUserParam = record.get('id');
                         var userNotificationFlagParam = record.get('userNotificationFlag');
                         
                           switch (operation){
                               case Ext.data.Record.EDIT:
                                       // Prompt for user data and process the result using a callback:
                                       Ext.Msg.confirm('<fmt:message key="sybiladmin.sybilUser.notificationConfirm"/>', '<fmt:message key="sybiladmin.sybilUser.notification"/>', function(btn)
                                       {
                                         
                                     if (btn == 'no'){
                                         store.rejectChanges();
                                     }     
                                       if (btn == 'yes'){
                                           Ext.Ajax.request({
                                                  url: url,
                                              method: 'POST',
                                              params : { 
                                                userId : idUserParam,
                                                userNotificationFlag : userNotificationFlagParam
                                              },
                                                headers: {'If-Modified-Since' : 'Thu, 1 Jan 1970 00:00:00 GMT'}, 
                                                success: function ( result, request ) {
                                                    //Ext.MessageBox.alert('Success', 'Data return from the server: '+ result.responseText); 
                                                },
                                                failure: function ( result, request) { 
                                                    Ext.MessageBox.alert('Failed', result.responseText); 
                                                    
                                                } 
                                       });
                                          store.commitChanges();
                                        }
                                     
                                    });                    
                               break;
                               case Ext.data.Record.REJECT:
                               break;
                               case Ext.data.Record.COMMIT:
                               break;
                           }
                      },
    
                     beforeload : function(usersListStore,record){
                           //Ext.MessageBox.alert( serviceInfo.baseParams.id );
                           this.baseParams.organisationId = serviceInfo.baseParams.id;
                       }
               }      
        });
    
    
        // the check column is created using a custom plugin
        var checkColumn = new Ext.grid.CheckColumn({
           header: '<fmt:message key="sybiladmin.sybilUser.userNotificationFlag"/>',
           dataIndex: 'userNotificationFlag',
           width: 100
        });

  3. #13

    Default

    But still searching how to close the thread....

  4. #14
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638

    Default

    Goto Post #1 of this thread, because you created it, you should be able to "Edit Post", it is gray at the bottom right of Post #1, then you should be able to edit it, but you need to go to the advanced editor, and there is a button at the bottom right of the editor called "Go Advanced". Once you do this, you can now put "Edit Reasons", and edit your "Title".

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 6
    Last Post: 23 Feb 2010, 8:49 AM
  2. Ext.data.Store update extension
    By receptor in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 12 Oct 2009, 6:56 AM
  3. [2.0b1][CLOSED] Ext.data.Store.insert misses to update snapshot
    By andrei.neculau in forum Ext 2.x: Bugs
    Replies: 6
    Last Post: 22 Sep 2009, 11:15 PM
  4. Replies: 2
    Last Post: 24 Mar 2009, 7:39 PM

Posting Permissions

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