0

in Extjs4.1.1a, I have a tab panel with grids as content. Each grid has an itemcontextmenu, with actions for items within the grid rows. Some of the grids have content that is "grouped", and when I open a tab with a grouping grid with a right-click mouse (itemcontextmenu) menu, I stop events and open the menu fine. Menu actions also appear to work fine, but every time I get this error - Ext.fly(node) is null - only on the grouped grids, and not on the normal grids.

okay: here is the cellcontextmenu (right-click) handler -

                beforecellcontextmenu: function(view, cell, columnIndex, rec, tableRow, rowIndex, e){
                    if (top.isAdmin == "Y") {
                        e.stopEvent();
                        e.preventDefault();

                        var thisItemID = rec.get('TARGETITEM_SEQ_ID');
                        var isVoid = rec.get('VOID_ROW');
                        top.selectedItemID = thisItemID;
                        top.isVoid = isVoid;

                        var column = view.getHeaderByCell(cell);
                        var position = view.getPositionByEvent(e);
                        var columnIndex = position.column;

                        var dataIndex = column.dataIndex;
                        //var dataIndex = columnIndex;

                        top.cellIndex = dataIndex;

                        // Define the model for a State
                        Ext.define('State', {
                            extend: 'Ext.data.Model',
                            fields: [
                                {type: 'string', name: 'abbr'},
                                {type: 'string', name: 'name', width: 25}
                            ]
                        });

                        // The data for all states
                        var yesNoPlus = [
                            {"abbr":"Yes","name":"Yes"},
                            {"abbr":"No","name":"No"},
                        ];

                        // The data store holding the states; shared by each of the ComboBox examples below
                        var yesNoPlusStore = Ext.create('Ext.data.Store', {
                            model: 'State',
                            data: yesNoPlus
                        });

                        // Simple ComboBox using the data store
                        var multiComboA8 = Ext.create('Ext.form.field.ComboBox', {
                            hideLabel: true,
                            store: yesNoPlusStore,
                            emptyText: 'Choose...',
                            displayField: 'name',
                            valueField: 'abbr',
                            typeAhead: true,
                            width: 150,
                            style: 'margin: 2px',
                            triggerAction: 'all',
                            queryMode: 'local',
                            selectOnFocus: true,
                            typeAhead: true,
                            //iconCls: 'no-icon'
                        });

                        //console.log('cell.ITEMNAME: ', cell.ITEMNAME + ', position: ', position + ', cell: ', cell + ', cellIndex: ', cellIndex + ', dataIndex: ', dataIndex);
                        if (dataIndex.match(/^TARGETVALUE.*$/)) 
                        { 
                            /*TARGETVALUE Match found */
                            var gridContextMenuA8 = Ext.create('Ext.menu.Menu', {
                                style: {
                                    overflow: 'visible'     // For the Combo popup
                                },
                                items: [
                                    voidActionA8,
                                    hideColumnA8, 
                                    '-', {
                                        text: 'Value Options',
                                        menu: {        // <-- submenu by nested config object
                                            items: [
                                                // stick any markup in a menu
                                                '<b class="menu-title">Set ALL values to...</b>',
                                                multiComboA8
                                            ]
                                        }
                                   }
                                ]
                            });
                            gridContextMenuA8.showAt(e.getXY());

                        } else {

                            /*No TARGETVALUE Match found */
                            var gridContextMenuA8 = Ext.create('Ext.menu.Menu', {
                                style: {
                                    overflow: 'visible'     // For the Combo popup
                                },
                                items: [
                                    voidActionA8,
                                    '-', {
                                        text: 'Value Options',
                                        menu: {        // <-- submenu by nested config object
                                            items: [
                                                // stick any markup in a menu
                                                '<b class="menu-title">Set ALL values to...</b>',
                                                multiComboA8
                                            ]
                                        }
                                   }
                                ]
                            });
                            gridContextMenuA8.showAt(e.getXY());
                        }

                        multiComboA8.on('select', function(combo, records, eOpts) {

                            var grid = Ext.widget('tablea8_targetgrid');
                            var selected = grid.selModel.getSelection();

                            Ext.Array.each(records, function(record) 
                            {        
                                var selectedValue = record.get('abbr');
                                console.log('Record value from combo: ' + selectedValue); 

                                if (selectedValue == 'No') {
                                    Ext.MessageBox.confirm(
                                        'Confirm - set ALL values to "No"',
                                        'Set ALL values for item: ' + top.selectedItemID + ' to "No", are you sure?',
                                        function(btn) {
                                            if (btn == 'yes') {
                                                console.log('Asking to set all values = No');
                                                // make all values = no code goes here

                                                var grid = Ext.widget('tablea8_targetgrid');
                                                console.log(grid);
                                                var theStore = grid.getStore();
                                                console.log(theStore);

                                                var targetName = top.recTargetName;
                                                var tableName = top.adminTableName;
                                                var familyName = top.familyName; 

                                                console.log('call AJAX request to set NO');
                                                Ext.Ajax.request({
                                                    url     : 'data/set_all_no_svc.php',
                                                    params  : { 
                                                        recordId: top.selectedItemID, 
                                                        setValue: 'No', 
                                                        familyName: top.familyName, 
                                                        tableName: top.ACTIVE_TABLE_NAME
                                                    },
                                                    method  : 'POST',
                                                    success : function(response, theRecord2) {
                                                        var res = Ext.JSON.decode(response.responseText);

                                                        if ((res.success) === false){
                                                            Ext.Msg.alert('Error',res.message);
                                                            return;
                                                        } else {    
                                                            // reload store for this tab
                                                            theStore.load({
                                                                params: {
                                                                    tableName: tableName,
                                                                    familyName: familyName,
                                                                    targetName: targetName
                                                                }
                                                            });                             
                                                            // close window
                                                            //voidwin.destroy();
                                                        }
                                                    }
                                                });
                                            }
                                        }
                                    );
                                } else if (selectedValue == 'Yes') {
                                    Ext.MessageBox.confirm(
                                        'Confirm - set ALL values to "Yes"',
                                        'Set ALL values for item: ' + top.selectedItemID + ' to "Yes", are you sure?',
                                        function(btn) {
                                            if (btn == 'yes') {
                                                console.log('Asking to set all values = Yes');
                                                // make all values = yes code goes here

                                                var grid = Ext.widget('tablea8_targetgrid');
                                                console.log(grid);
                                                var theStore = grid.getStore();
                                                console.log(theStore);

                                                var targetName = top.recTargetName;
                                                var tableName = top.adminTableName;
                                                var familyName = top.familyName; 

                                                console.log('call AJAX request to set YES');
                                                Ext.Ajax.request({
                                                    url     : 'data/set_all_yes_svc.php',
                                                    params  : { 
                                                        recordId: top.selectedItemID, 
                                                        setValue: 'Yes', 
                                                        familyName: top.familyName, 
                                                        tableName: top.ACTIVE_TABLE_NAME
                                                    },
                                                    method  : 'POST',
                                                    success : function(response, theRecord2) {
                                                        var res = Ext.JSON.decode(response.responseText);

                                                        if ((res.success) === false){
                                                            Ext.Msg.alert('Error',res.message);
                                                            return;
                                                        } else {    
                                                            // reload store for this tab
                                                            theStore.load({
                                                                params: {
                                                                    tableName: tableName,
                                                                    familyName: familyName,
                                                                    targetName: targetName
                                                                }
                                                            });                             
                                                            // close window
                                                            //voidwin.destroy();
                                                        }
                                                    }
                                                });
                                            }
                                        }
                                    );
                                }   
                            });
                        });
                        return false;
                    }       
                },

///////

And here are the 'Action' functions called from within the menu:

function findColumnByDataIndex(grid, dataIndex) {
    console.log('dataIndex: ', dataIndex);
    var selector = "gridcolumn[dataIndex=" + dataIndex + "]";
    console.log('selector: ', selector);
    return grid.down(selector);
};

var hideColumnA8 = Ext.create('Ext.Action', {
    text: 'Hide column?',
    iconCls: 'icon-hide',

    handler: function(widget, event) {
        var grid = Ext.ComponentQuery.query('#tablea8_targetgrid_id')[0];     
        var gridView = grid.getView();

        var columnToHide = findColumnByDataIndex(grid, top.cellIndex);                                      
        console.log('columnToHide: ', columnToHide);

        columnToHide.hide();
        gridView.refresh();

}

});

////

And lastly the voidrow function:

var voidActionA8 = Ext.create('Ext.Action', {
        iconCls: 'icon-void',
        text: 'Void actions',
        handler: function(widget, event) {
            var grid = Ext.widget('tablea8_targetgrid');
            var selected = grid.selModel.getSelection();

            console.log('void value: ', top.isVoid);

            if ((top.isVoid == 'false') || (top.isVoid == null) || (top.isVoid == "")){ 
                Ext.MessageBox.confirm(
                    'Confirm VOID this row from A8',
                    'Void item: ' + top.selectedItemID + ', are you sure?',
                    function(btn) {
                        if (btn == 'yes') {
                            console.log('Asking to VOID row');
                            // void row action goes here

                            var grid = Ext.widget('tablea8_targetgrid');
                            console.log(grid);
                            var theStore = grid.getStore();
                            console.log(theStore);

                            var targetName = top.recTargetName;
                            var tableName = top.adminTableName;
                            var familyName = top.familyName; 

                            console.log('call AJAX request');
                            Ext.Ajax.request({
                                url     : 'app/store/dbcall/target/GG/set_void_svc.php',
                                params  : { 
                                    recordId: top.selectedItemID, 
                                    voidValue: 'true', 
                                    familyName: top.familyName, 
                                    tableName: top.ACTIVE_TABLE_NAME
                                },
                                method  : 'POST',
                                success : function(response, theRecord2) {
                                    var res = Ext.JSON.decode(response.responseText);

                                    if ((res.success) === false){
                                        Ext.Msg.alert('Error',res.message);
                                        return;
                                    } else {    
                                        // reload store for this tab
                                        theStore.load({
                                            params: {
                                                tableName: tableName,
                                                familyName: familyName,
                                                targetName: targetName
                                            }
                                        });                             
                                        // close window
                                        //voidwin.destroy();
                                    }
                                }
                            });
                        }
                    }
                );
            } else {
                Ext.MessageBox.confirm(
                    'Confirm return ROW to normal state',
                    'UN-Void item: ' + top.selectedItemID + ', are you sure?',
                    function(btn) {
                        if (btn == 'yes') {
                            console.log('Asking to UN-VOID row');
                            // void row action goes here

                            var grid = Ext.widget('tablea8_targetgrid');
                            console.log(grid);
                            var theStore = grid.getStore();
                            console.log(theStore);

                            var targetName = top.recTargetName;
                            var tableName = top.adminTableName;
                            var familyName = top.familyName; 

                            console.log('call AJAX request to UN-VOID row');
                            Ext.Ajax.request({
                                url     : 'app/store/dbcall/target/GG/set_void_svc.php',
                                params  : { 
                                    recordId: top.selectedItemID, 
                                    voidValue: 'false', 
                                    familyName: top.familyName, 
                                    tableName: top.ACTIVE_TABLE_NAME
                                },
                                method  : 'POST',
                                success : function(response, theRecord2) {
                                    var res = Ext.JSON.decode(response.responseText);

                                    if ((res.success) === false){
                                        Ext.Msg.alert('Error',res.message);
                                        return;
                                    } else {    
                                        // reload store for this tab
                                        theStore.load({
                                            params: {
                                                tableName: tableName,
                                                familyName: familyName,
                                                targetName: targetName
                                            }
                                        });                             
                                        // close window
                                        //voidwin.destroy();
                                    }
                                }
                            });
                        }
                    }
                );
            }           
        }
    });
PaulW
  • 39
  • 10
  • Hi PaulW. You can help others help you by providing some code. Generally speaking I assume the issue is most likely to be with how you do things rather than this being a bug in the library. It would also help if you provide the call stack leading to this error. – Izhaki Dec 11 '12 at 21:58
  • The code I have is quite long. Trying to determine where in the code the error may be occurring is part of the issue. Is there any place I need to grab the code from to show you? As I stated the error does NOT occur with a standard grid I use in part of the code. It ONLY occurs with grids that have a mulitple header and are grouped. Also the error is not stopping any functionality for the popup menu. All functions continue to work fine, with the exception of the error, that shows in Firebug. – PaulW Dec 11 '12 at 23:55
  • A call stack would be the place to start. Would also be useful to see the event handler of `itemcontextmenu`. – Izhaki Dec 12 '12 at 00:03
  • The code I have is quite long. Trying to determine where in the code the error may be occurring is part of the issue. Is there any place I need to grab the code from to show you? the error does NOT occur with a standard grid, it ONLY occurs with grids with multiple header and are grouped. functions continue to work fine. error shows in ext-all-debug.js (line 99591) TypeError: Ext.fly(...) is null – PaulW Dec 12 '12 at 00:06
  • How do I get the call stack for that spot? – PaulW Dec 12 '12 at 00:06
  • okay. I put a break point on line 99591 on ext-all-debug and I have the onRowFocus code. the error is occurring with 'onRowFocus' – PaulW Dec 12 '12 at 00:13
  • onRowFocus()ext-all-debug.js (line 92423) rowIdx = 0 highlight = true supressFocus = undefined – PaulW Dec 12 '12 at 00:17
  • onRowFocus()ext-all-debug.js (line 99591) rowIdx = [Trial] MyApp.model.target.GG.MultipleTargetGridListModel { id= "MyApp.model.target.GG.M...leTargetGridListModel-1" } fire()ext-all-debug.js (line 8896) – PaulW Dec 12 '12 at 00:18
  • I do not see the event handler for itemcontextmenu in the stack – PaulW Dec 12 '12 at 00:20
  • Does no one have an answer based on the responses from Firebug I posted? – PaulW Dec 18 '12 at 21:26
  • I need to know where I would see the "event handler" for itemcontextmenu or cellcontextmenu – PaulW Dec 18 '12 at 21:27
  • First, please post your callstack in the question rather then in the comments - it would be much easier to read. Then, I would assume you are the one who wrote the event handler - the code that runs when the user right click. – Izhaki Dec 18 '12 at 21:29
  • Okay, I added some code to my question, showing the cellcontextmenu (right-click) menu and the functions called from the menu – PaulW Dec 20 '12 at 22:48

0 Answers0