Results 1 to 2 of 2

Thread: e.record.commit in editorgrid works not correctly

  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    17

    Default e.record.commit in editorgrid works not correctly

    The problem starts from afteredit function, in which e object have field property undefined, ok I went another way, name of the field I get like this e.record.fields.keys[e.column]. But another problem has been found. e.record.commit() not works correctly. changed cell do not always saves in browser, in DB data saves. From what it is depends of I do not understand.
    PHP Code:
           var store = new Ext.data.GroupingStore({
                    
    url'scripts/loadShopList.php',
                    
    reader : new Ext.data.JsonReader({root:'rows',id:'id'},[
                        
    'id',
                        
    'code',
                        
    'group_id',
                        
    'city',
                        
    'address'
                    
    ])
                });
          function 
    shopGroup_name(val){
                    
                    return 
    shopGroups.queryBy(function(rec){
                        return 
    rec.data.id == val;
                    }).
    itemAt(0).data.group_name;
                }  
                
                var 
    shopGroupEdit = new Ext.form.ComboBox({
                    
    typeAhead true,
                    
    triggerAction 'all',
                    
    mode 'local',
                    
    store shopGroups,
                    
    displayField 'group_name',
                    
    valueField 'id'
                
    });

          function 
    showMarketGroups(){
                        if(!
    shopGroups){
                            
    Ext.getBody().mask('?????????...');
                            
    shopGroups = new Ext.Window({
                                
    layout 'fit',
                                
    title '?????? ?????????',
                                
    closeAction 'close',
                                
    width 550,
                                
    height 400,
                                
    40,
                                
    60,
                                
    listeners : {
                                    
    close : function(){
                                        
    shopGroups 0;
                                    }
                                },
                                
    items : {
                                    
    xtype 'tabpanel',
                                    
    id'shopGroups',
                                    
    //renderTo: Ext.get('content'),
                                    
    activeTab0,
                                    
    //height : 1000,
                                    
    width 600,
                                    
    height 500,
                                    
    padding 4,
                                   
                                    
    items: [{
                                        
    titlelng.Headers.Groups.ShopGroups.ShopTab,
                                        
    xtype'editorgrid',
                                        
    storestore,
                                        
    enableColumnMovefalse
                                        
    //autoExpandColumn: 'city',
                                        
    clickstoEdit1,//store : sc.getShopGridStore,
                                        
                                        
                                        
    columns : [
                                            {
    header '????????????',dataindex 'id',id 'id'},
                                            {
    header '???',dataindex 'code'id 'code'},
                                            {
    header 'group_id',dataindex 'group_id',renderershopGroup_nameeditorshopGroupEditid'group_id'},
                                            {
    header '?????',dataindex 'city'id 'city'},
                                            {
    header '?????',dataindex 'address'}    
                                        ],
                                        
    listeners : {
                                            
    afteredit : function(e){
                                                if (
    e.record.fields.keys[e.column] == 'group_id'){
                                                    var 
    conn = new Ext.data.Connection();
                                                    
    conn.request({
                                                        
    url 'scripts/groups_Operation.php',
                                                        
    params : {
                                                            
    action 'update',
                                                            
    id e.record.id,
                                                            
    field e.record.fields.keys[e.column],
                                                            
    value e.value,
                                                            
    func 'group_id'
                                                        
    },
                                                        
    success : function(resp,opt){
                                                            
                                                            
    e.record.commit();
                                                            
    alert(1111)
                                                            
                                                        },
                                                        
    failure : function(resp,opt){
                                                            
                                                            
    e.record.reject();
                                                            
    alert(2222)
                                                        }
                                                    });
                                                }          
                                            }
                                        },
                                        
                                        
    view: new Ext.grid.GroupingView(),
                                        
    sm: new Ext.grid.RowSelectionModel({
                                            
    singleSelecttrue
                                        
    })    
                                        
                                    },{ 
                                        
    titlelng.Headers.Groups.ShopGroups.ShopGroupsTab,
                                        
    html'Another one'
                                    
    }]
                                }
                            });
                            
    shopGroups.show();
                            
    Ext.getBody().unmask('?????????...');    
                        }
                } 

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Posts
    17

    Exclamation without new Ext.Window works correctly

    If tabpanel is a single element (not child of Ext.Window) - e.record.commit() function works not correctly too ((. Also I noticed that reject of data fires before I call e.record.reject();

Posting Permissions

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