Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Ext User FATAL1TY's Avatar
    Join Date
    Feb 2009
    Location
    Nice, France
    Posts
    38
    Vote Rating
    0
    FATAL1TY is on a distinguished road

      0  

    Default Problem when Deleting From Editor Grid.

    Problem when Deleting From Editor Grid.


    Hi Guys,
    I have a problem since yesterday when i try to remove a record from an EditorGrid. Actually in my editorGrid i'm using a plugin to bound the selected record into a form. So this is my Grid:
    Code:
        var grid_Entite = new Ext.grid.EditorGridPanel({
            region        :    'center',
            autoHeight    :    true,
            id            :    'grid_Entite',
            store        :    entStore,
            title        :    'Liste des entite',
            clickstoEdit:    1,
            frame        :    true,
            
            stripeRows    :    true,
            columns        :    [
                {header    :    'Nom',    dataIndex    :    'Nom', editor    :    new Ext.form.TextField(), },
                {header    :    'Description',    dataIndex    :'Description',editor    : new Ext.form.TextField() },
                {header    :    'Activite',    dataIndex    :    'Activite',    hidden : true},
                {header    :    'Id',    dataIndex    :    'ID_Ent'}
            ],
            tbar:[{
                     text:'Nouveau'
                    ,iconCls:'icon-plus'
                    ,scope:this
                    ,handler:function() {
                        var s = grid_Entite.store;
                        var r = new (s.recordType)({Nom:'', Description:'', Adresse:'',Telephone:'',SiteWeb:'', Activite:'',Categorie:''});
                        s.add(r);
                        grid_Entite.startEditing(s.indexOf(r), 0);
                    }
                },{
                     text:'Unselect'
                    ,scope:this
                    ,iconCls:'icon-undo'
                    ,handler:function() {
                        grid_Entite.getSelectionModel().clearSelections();
                    }
                }],
            plugins:[new Ext.ux.grid.Search({
                    iconCls:'icon-zoom'
                    ,minChars:1
                    ,autoFocus:true
                    ,mode:'local'
                    ,position:top
    //                ,menuStyle:'radio'
            })],
                
            viewConfig:{forceFit:true, scrollOffset:0},
            listeners:{
                render:function() {
                    this.getSelectionModel().on({
                        // selectionchange is fired too often for us, so buffer it for 10ms
                        selectionchange:{buffer:10, fn:function(sm, selection) {
                            // Enlever le filtre des combo : 
                            var comboCat = Ext.getCmp("categories"); 
                            comboCat.store.clearFilter(false) ; 
                            
                            
                            // get record from either Cell of Row SelectionModel
                            var record = selection && selection.record ? selection.record : null;
                            if(!record && sm && sm.getSelected) {
                                record = sm.getSelected();
                            }
                            
                            // Appliquer le filtre sur le combo Categorie suivant l'activite selectionnée. 
                            comboCat.store.filter("Act",record.get("Activite"));
                            
                            // don't bind same record twice
                            if(record && (this.boundRecord !== record)) {
    //                                console.log('bind', record);
                                Ext.BindMgr.unbind(this.boundRecord);
                                Ext.BindMgr.bind(record, ['exampleform']);
                                this.boundRecord = record;
                            }
                            
                            // unbind
                            else if(!record) {
    //                                console.log('unbind');
                                Ext.BindMgr.unbind(this.boundRecord);
                                this.boundRecord = null;
                            }
                        }}
                    })
                }
            },sm : new Ext.grid.RowSelectionModel({singleSelect: true})
        });
    Here is the Code of the button i'm using for deleting.
    Code:
                        ,handler: function(){
                            var conn = new Ext.data.Connection();
                            conn.request({
                                url : 'controlEntite.php',
                                params : {
                                    action : 'effacer',
                                    id       : Ext.getCmp('ID_Ent').getValue()
                                },
                                success:    function(f,a){
                                    Ext.Msg.alert('Suppression d\'une entité','Entité effacée !'); 
                                    var sm = grid_Entite.getSelectionModel();
                                    var deleteRow = sm.getSelected();
                                    grid_Entite.getStore().remove(deleteRow);
                                    //grid_Entite.deleteRecord();
    
                                },
                                failure:    function(f,a){
                                    Ext.Msg.alert('Echec de l\'operation');
                                }
                            });
                         }
    And now here is the errror I'm getting :
    Code:
    record is undefined
    [IMG]chrome://firebug/content/blank.gif[/IMG]						comboCat.store.filter("Act",record.get("Activite")
    Thanks for your help guys.

  2. #2
    Ext JS Premium Member Lloyd K's Avatar
    Join Date
    Oct 2007
    Location
    Brighton, United Kingdom
    Posts
    655
    Vote Rating
    1
    Lloyd K is on a distinguished road

      0  

    Default


    If record is undefined I suspect this is then failing:

    Code:
    var record = selection && selection.record ? selection.record : null;
    
    if(!record && sm && sm.getSelected) {
        record = sm.getSelected();
    }
    As to why I'm not sure :S
    - Lloyd K

    I blog about code from time to time: http://codeology.lloydkinsella.net/

Thread Participants: 1