1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Answers
    1
    Vote Rating
    0
    elnaz is on a distinguished road

      0  

    Default Answered: Delete Buttton problem

    Answered: Delete Buttton problem


    Hi ,

    I want to delete selected row from list ,but it said :
    ' grid.getSelectionModel is not a function '


    here is my controller code:
    Code:
    'relation button[action=delete]':{
            click:this.deleteList
            }
    Code:
    deleteList:function(button) {
              var grid = button.up('relation');
              grid.store.remove(grid.getSelectionModel().getSelection());
    }

    here my button code in list panel

    Code:
     buttons: [
              {
              text: 'Delete',
                  action: 'delete',
                  scope:this,
                 id: 'list-delete'
              
                  }]
    and here my list inside of tab panel:

    Code:
     items: [{
            title: 'Author',
        xtype: 'container',
               items:[{
            align:'center',
            xtype:'gridpanel',
                store: 'StoreAuthor',
           selType: 'checkboxmodel',
                columns: [
                {header:'Method',dataIndex:'method', flex: 1,align:'center'},
                {header:'Information',dataIndex:'Info', flex: 1,align:'center'},
                
            ]
        }]
    
        },{
            title: 'Activite',
        xtype: 'container',
               items:[{
            align:'center',
            xtype:'gridpanel',
                store: 'StoreAuthor',
            selType: 'checkboxmodel',
                   columns: [
                {header:'Method',dataIndex:'method', flex: 1,align:'center'},
                {header:'Information',dataIndex:'Info', flex: 1,align:'center'},
                
            ]
        }]
        },{
            title: 'Relations',
        xtype: 'container',
               items:[{
            align:'center',
            xtype:'gridpanel',
                store: 'StoreAuthor',
            selType: 'checkboxmodel',
                   columns: [
                {header:'Method',dataIndex:'method', flex: 1,align:'center'},
                {header:' Information',dataIndex:'Info', flex: 1,align:'center'},
                
            ]
        }]
        }
    is any one knows what is the problem ?

  2. It's work thanks Mehdi

    I just using query("gridpanel")[0];

    Code:
    var grid = button.up('relation').query("gridpanel")[0];
              grid.store.remove(grid.getSelectionModel().getSelection());

  3. #2
    Sencha User
    Join Date
    Sep 2010
    Location
    Bremen, Germany
    Posts
    41
    Answers
    1
    Vote Rating
    0
    momesana is on a distinguished road

      0  

    Default do the obvious

    do the obvious


    Hi Elnaaz,
    Without (thoroughly) reading the code I would advise you to check if the parent of the button really is the grid. Basically what you should do is, set a break point (using a proper debugger like the one shipped with chrome [chrome developer tools] or firebug) inside the function after the "var grid ..." line is executed and check to see what the element is. You could use grid.getXtype() in the console when you are inside the function or use "Watched expressions" for that. Hope that helps ya!

    Cheers
    Mehdi

  4. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Answers
    1
    Vote Rating
    0
    elnaz is on a distinguished road

      0  

    Default


    Thanks,

    but my panel is extend: 'Ext.tab.Panel',
    and then inside of tab I have container and gridlist



    is it the problem?

  5. #4
    Sencha User
    Join Date
    Sep 2010
    Location
    Bremen, Germany
    Posts
    41
    Answers
    1
    Vote Rating
    0
    momesana is on a distinguished road

      0  

    Default


    I don't fully comprehend what your code is supposed to do. You have a line where a button is used to traverse up it's ancestors until it finds a component that matches the selector 'relation' and then assumes that this is a grid. Check it in the debugger. You could workaround this issue using an id on the grid and then getting the component like so:

    Code:
    var grid = Ext.getCmp('yourId');
    or by using the ComponentQuery:
    Code:
    var grid = Ext.ComponentQuery.query('... componentQuery selector ...');
    Again: Check it in the debugger. Once you are at the breakpoint you can type all the stuff into the console and validate them without the need for guessing and going through the regular edit > save > reload cycle.

    Cheers
    Mehdi

  6. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Answers
    1
    Vote Rating
    0
    elnaz is on a distinguished road

      0  

    Default


    thanks ,

    but it doesn't work yet

    I have another panel that call my tab panel there
    as you said I think I should use query but I don't know how

    I use debugger also but I 'm relay new to extjs couldn't find the error yet

    Code:
      extend: 'Ext.panel.Panel',     alias:'widget.vPanel',     width: '100%',     height: '100%',          layout: {                                 type: 'vbox',         align: 'center'     },      items: [{                                 xtype: 'detailPanel',     id: 'detail-panel',      maxHeight:280,         width: '100%',         flex: 4                        },{     xtype: 'relation',     id: 'relations-panel',         width: '100%',              flex: 1      }] });

  7. #6
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Answers
    1
    Vote Rating
    0
    elnaz is on a distinguished road

      0  

    Default


    It's work thanks Mehdi

    I just using query("gridpanel")[0];

    Code:
    var grid = button.up('relation').query("gridpanel")[0];
              grid.store.remove(grid.getSelectionModel().getSelection());

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar