1. #1
    Ext User
    Join Date
    Nov 2008
    Posts
    212
    Vote Rating
    0
    yannickiwi is on a distinguished road

      0  

    Default button on tab grid error

    button on tab grid error


    Hi,

    I have this code:
    Code:
    var grid = new Ext.grid.GridPanel({
            renderTo: document.body,
            frame: true,
            title: 'Looser to be or not to be a looser',
            tbar:[{
                text:'changer le prenom',
                handler: function(){
                    var sm = grid.getSelectionModel();
                    if (sm.hasSelection()){
                        var sel = sm.getSelected();
                        Ext.Msg.show({
                            title: 'Change Prenom',
                            prompt: true,
                            buttons: Ext.MessageBox.OKCANCEL,
                            value: sel.data.title,
                            fn: function(btn, text) {
                                if (btn == 'ok'){
                                    sel.set('prenom', text);
                            }
                        }
                        });
                    }
                }
            },{
                text: 'Cacher le signe',
                handler: function(btn){
                    var cm = grid.getColumnModel();
                    var pi = cm.getIndexById('signe');
                    if (cm.isHidden(pi)) {
                        cm.setHidden(pi, false);
                        btn.setText('Cacher le signe');
                    } else {
                        cm.setHidden(pi, true);
                        btn.setText('Afficher le signe')
                    }
                    btn.render();
                }
            }],
            height: 200,
            width:500,
            store: store,
            columns: [
                {header: "Nom", dataIndex:'nom', render: genre_name},
                {header: "prenom", dataIndex:'prenom'},
                {header: "date", dataIndex:'date'},
                {header: 'heure', dataIndex:'heure'},
                {header: 'signe', dataIndex: 'signe'}
            ]
            
        });
    You can look my grid here: http://immobilier.bluesys.ch/ (bottom of the page), if you click on "cacher le signe" (seconde button of tbar), you can look this error:

    Code:
    this.config[a] is undefined
    Ext.DomHelper=function(){var n=null;var ...(Ext.History,new Ext.util.Observable());
    , the specified source is:
    Code:
    {
                text: 'Cacher le signe',
                handler: function(btn){
                    var cm = grid.getColumnModel();
                    var pi = cm.getIndexById('signe');
                    if (cm.isHidden(pi)) {
                        cm.setHidden(pi, false);
                        btn.setText('Cacher le signe');
                    } else {
                        cm.setHidden(pi, true);
                        btn.setText('Afficher le signe')
                    }
                    btn.render();
                }
            }
    Do you know the source of the error?

    Thank you very mutch

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,544
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    What are you doing using ext-all.js when it's been posted here again and again and again and again and again and again and again and again and again and that you should develop with ext-all-debug.js?

  3. #3
    Ext User
    Join Date
    Nov 2008
    Posts
    212
    Vote Rating
    0
    yannickiwi is on a distinguished road

      0  

    Default


    width ext-all-debug:
    Code:
    this.config[colIndex] is undefined
           return this.config[colIndex].hidden;
    I follow the tutorial on "Learning ExtJS book" buyed last freeday. and it's a simple copy/past of her code but I have change the column name.

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,146
    Vote Rating
    673
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Ok, so what colIndex are you trying to find? What are you passing into the method?

    Hint: None of your columns have an id specified.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Ext User
    Join Date
    Nov 2008
    Posts
    212
    Vote Rating
    0
    yannickiwi is on a distinguished road

      0  

    Default


    the column 'signe':
    Code:
    var pi = cm.getIndexById('signe');
    ...
    columns: [
                {header: "Nom", dataIndex:'nom', render: genre_name},
                {header: "prenom", dataIndex:'prenom'},
                {header: "date", dataIndex:'date'},
                {header: 'heure', dataIndex:'heure'},
                {header: 'signe', dataIndex: 'signe'}
            ]

  6. #6
    Ext User
    Join Date
    Nov 2008
    Posts
    212
    Vote Rating
    0
    yannickiwi is on a distinguished road

      0  

    Default


    Do you know the error?

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,146
    Vote Rating
    673
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Do a bit of debugging, what does the function return?

    Hint: None of your columns have an id specified.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  8. #8
    Ext User
    Join Date
    Nov 2008
    Posts
    212
    Vote Rating
    0
    yannickiwi is on a distinguished road

      0  

    Default


    If I ask is that I understand, else I no win my time

    I have specified here: {header: 'signe', dataIndex: 'signe'}, what I get: var pi = cm.getIndexById ( 'sign'); not?

  9. #9
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,146
    Vote Rating
    673
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Code:
    var pi = cm.getIndexById('signe');
    What is the value of pi? If so, why do you think it is?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  10. #10
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    6
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    Anyone know how you say "id" in french?

Thread Participants: 3