Results 1 to 2 of 2

Thread: type error b is null store and grid problem

  1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    38
    Answers
    1
    Vote Rating
    1
      0  

    Default Unanswered: type error b is null store and grid problem

    My app has a grid, on double click on a record a window appear. In this windows there are two tabs, in the first I print a table with all the information of the selected row, in the second tab I have another grid linked with another store that display a sort of "logger" to see the activities of the selected row. My problem is that when I double click on a row the window appears and the activity store is loaded perfectly. But if I close the window and then I double click on another row, the Activity tab is empty and the error is TypeError: b is null.

    My activity store
    Code:
    var actStore = Ext.create('Ext.data.Store', {
                        storeId: 'actStore',
                        model: actModel,
                        proxy: {
                            type: 'ajax',
                            url: 'script/request.php?operazione=readactivities',
                            reader: {
                                type: 'json',
                                root: 'activities',
                                totalProperty: 'results'
                            }
                        }
                    });
    My double click listener on main grid
    Code:
    itemdblclick: function(tablepanel, record, item, index, e, options){
                                actStore.load({
                                    params: {
                                        idaffiliato: record.data.id
                                    }
                                });
                                var editWindow = new Ext.Window({
                                    title: 'Modifica informazioni',
                                    width: 600,
                                    listeners: {
                                        close: function(){
                                           
                                        }
                                    },
                                    items: [
                                        {
                                            xtype: 'tabpanel',
                                            activeTab: 0,
                                            items: [
                                                {
                                                    xtype: 'panel',
                                                    title: 'Info generali',
                                                    id: 'infoTab',
                                                    width: 600,
                                                    tpl: [
                                                        '<table class="infoTab"><tr><th>Data</th><td>{date}</td></tr>',
                                                        '<tr><th>Nome</th><td>{nome}</td></tr>',
                                                        '<tr><th>Cognome</th><td>{cognome}</td></tr>',
                                                        '<tr><th>Indirizzo</th><td>{indirizzo}</td></tr>',
                                                        '<tr><th>Citt&agrave;</th><td>{citta}</td></tr>',
                                                        '<tr><th>Provincia</th><td>{provincia}</td></tr>',
                                                        '<tr><th>Telefono</th><td>{telefono}</td></tr>',
                                                        '<tr><th>Et&agrave;</th><td>{eta}</td></tr>',
                                                        '<tr><th>Titolo di studio</th><td>{titolo}</td></tr>',
                                                        '<tr><th>Professione attuale</th><td>{professione}</td></tr>',
                                                        '<tr><th>Possibilit&agrave; di investimento</th><td>{investimento}</td></tr>',
                                                        '<tr><th>Destinazione attivit&agrave;</th><td>{destinatario}</td></tr>',
                                                        '<tr><th>Localit&agrave; di interesse</th><td>{localita}</td></tr>',
                                                        '<tr><th>Inizio attivit&agrave;</th><td>{timing}</td></tr>',
                                                        '<tr><th>Email</th><td>{email}</td></tr>',
                                                        '<tr><th>Messaggio</th><td>{note}</td></tr>',
                                                        '<tr><th>News</th><td>{news}</td></tr>',
                                                        '<tr><th>Stato</th><td>{stato}</td></tr>',
                                                        '</table>'
                                                        
                                                    ]
                                                },
                                                {
                                                    xtype: 'panel',
                                                    title: 'Attivit&agrave;',
                                                    width: 600,
                                                    items: [
                                                        activitiesGrid,
                                                        {
                                                            xtype: 'form',
                                                            id: 'actForm',
                                                            title: 'Aggiungi nota',
                                                            layout: 'vbox',
                                                            bodyPadding: 10,
                                                            items: [
                                                                {
                                                                    xtype: 'textarea',
                                                                    name: 'note',
                                                                    fieldLabel: 'Note',
                                                                    allowBlank: false,
                                                                    width: 400,
                                                                    blankText: 'Questo campo &egrave; obbligatorio',
                                                                    msgTarget: 'under'
                                                                },
                                                                {
                                                                    xtype: 'checkbox',
                                                                    fieldLabel: 'Remind',
                                                                    name: 'remind',
                                                                    listeners: {
                                                                        change: function(){
                                                                            if(this.checked){
                                                                                Ext.getCmp('dateField').setVisible(true);
                                                                            }
                                                                            else {
                                                                                Ext.getCmp('dateField').setVisible(false);
                                                                            }
                                                                        }
                                                                    }
                                                                },
                                                                {
                                                                    xtype: 'datefield',
                                                                    fieldLabel: 'Data remind',
                                                                    id: 'dateField',
                                                                    name: 'data_remind',
                                                                    format: 'd/m/Y',
                                                                    hidden: true
                                                                },
                                                                {
                                                                    xtype: 'hiddenfield',
                                                                    value: record.data.id,
                                                                    name: 'idaffiliato'
                                                                },
                                                                {
                                                                    xtype: 'button',
                                                                    text: 'Invia',
                                                                    handler: function(){
                                                                        var actForm = Ext.getCmp('actForm');
                                                                        
                                                                        if(actForm.getForm().isValid()) {
                                                                            actForm.getForm().submit({
                                                                                url: 'script/request.php?operazione=addactivity',
                                                                                method: 'POST',
                                                                                success: function(){
                                                                                    actForm.getForm().reset();
                                                                                    actStore.load({
                                                                                        params: {
                                                                                            idaffiliato: record.data.id
                                                                                        }
                                                                                    });
                                                                                },
                                                                                failure: function(){
                                                                                    Ext.Msg.alert('Avviso', 'Operazione non eseguita');
                                                                                }
                                                                            });
                                                                        }
                                                                    }
                                                                }
                                                            ]
                                                        }
                                                    ]
                                                }
                                            ]
                                        }
                                    ]
                                });
                                Ext.getCmp('infoTab').update(record.data);
                                
                                editWindow.show();
                            }
    The first time I load the page the script works:
    screen.png

    If I close this window and then double click on another record the new window that appears is like this:
    screen error.png

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    So have you set a breakpoint/debugger and followed the code to see what is going on?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread

Posting Permissions

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