Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3790
'_injectGrid' of undefined or null reference
posted

getting error only in IE and chrome not the other browsers.

SCRIPT5007: Unable to get property '_injectGrid' of undefined or null reference
infragistics.ui.grid.framework.js, line 25 character 115910

here is the call stack.
    _initFeature, infragistics.ui.grid.framework.js, line 25
    Anonymous function, jquery-ui-1.9.1.m1n.js, line 5
    dataBind, infragistics.ui.grid.framework.js, line 25
    Anonymous function, jquery-ui-1.9.1.m1n.js, line 5
    _create, infragistics.ui.grid.framework.js, line 25
    Anonymous function, jquery-ui-1.9.1.m1n.js, line 5
    _createWidget, jquery-ui-1.9.1.m1n.js, line 5
    _createWidget, infragistics.ui.grid.framework.js, line 25
    Anonymous function, jquery-ui-1.9.1.m1n.js, line 5
    Anonymous function, jquery-ui-1.9.1.m1n.js, line 5
    Anonymous function, jquery-ui-1.9.1.m1n.js, line 5
    each, jquery-1.8.2.m1n.js, line 2
    each, jquery-1.8.2.m1n.js, line 2
    Anonymous function, jquery-ui-1.9.1.m1n.js, line 5
>    Anonymous function, dataSheet.js, line 146
    _notifyLoaded, infragistics.loader.js, line 8
    Anonymous function, infragistics.loader.js, line 8
    _waitBatches, infragistics.loader.js, line 8
    load, infragistics.loader.js, line 8
    loader, infragistics.loader.js, line 8
    dataSheet, dataSheet.js, line 144
 

Since I only have the minified version I can not figure out the issue.

here is my builder

---------------------------------

$.ig.loader( function ()
        {
            inIUDiv.igGrid( {

                autoCommit: true,
                autoGenerateColumns: agc,
                columns: columns,
                fixedHeaders: true,
                autoFormat: "mumber",
                dataSourceType: "array",
                width: INSTANCE.gridWidth,
                height: INSTANCE.gridHeight,
                dataSource: inData,
                features: [
                {
                    name: "Resizing",
                    columnSettings: [ { columnIndex: 0, allowResizing: false } ],//could use columnKey to choose based on column name like _spaceChar
                    deferredResizing: false,
                    allowDoubleClickToResize: true,
                    columnResizing: function ( )
                    {
                        return false;//dont want this

                    }
                },
                {
                    name: "Selection",
                    mode: "cell",
                    multipleSelection: true,
                    mouseDragSelect: true, // default value for selecting multiple cells with the mouse
                    touchDragSelect: true, // default value for selecting multiple cells with a finger
                    cellSelectionChanged: function ( evt, ui )
                    {
                        if ( ui.selectedCells.length > 1 && !INSTANCE.function_ )// more then one cell is selected. Needs this for scalars and tables
                        {
                            if ( ui.cell.index == 0 ) return false //fixes selecting from cells to row cells in table mode.

                            if ( ui.selectedCells[0].columnKey == _spaceChar ) { ui.owner.clearSelection(); return false } //fix for the selction starting in the row header

                        }

                        //build selection data - this needs an event realy...
                        var cells = INSTANCE.gridIDMap.selectedCells()
                        var firstColumn = cells[0].columnKey;
                        var row = 1, col = -1, x = 1;
                        for ( ; x < cells.length; x++ )
                        {
                            if ( col == -1 && cells[x].columnKey == firstColumn ) col = x;//only count the first pass
                            if ( cells[x].columnKey == firstColumn ) row++;//for each time we find a match its a new row.
                        }
                        if ( col == -1 ) col = x;
                        INSTANCE.selectionData = cells;
                        INSTANCE.selectionRows = row;
                        INSTANCE.selectionColumns = col;

                    },
                    cellSelectionChanging: function ( evt, ui )
                    {
                        if ( ui.cell && ui.cell.index == 0 && !INSTANCE.function_ )//selets a row via click. Needs this for scalars and tables
                        {
                            ui.owner.clearSelection();
                            for ( var j = inIUDiv.igGrid( "option", "columns" ).length -1; j > 0; j-- )
                            {
                                INSTANCE.igGridSelection.selectCell( ui.cell.rowIndex, j );
                            }
                            return false
                        }
                    }
                },
                {
                    name: "Updating",
                    editMode: "cell",
                    enableAddRow: false,
                    enableDeleteRow: false,
                    startEditTriggers: "dblclick",
                    editCellStarting: function ( evt, ui )
                    {
                        //was using this to prevent edits to some columns but that is no longer needed.

                        //we do need to catch an enter.
                        if ( evt.keyCode === 13 )
                        {
                            //document.forms[0].submit();
                            return false;
                        }
                        return true;
                    },
                    editCellEnded: function ( evt, ui )
                    {
                        var cells = INSTANCE.igGridSelection.selectedCells();
                        if ( cells.length > 0 )
                        { //current cells in edit mode
                            for ( var c = 0; c < cells.length; c++ )//selection exists, format them all.
                            {
                                //all cells but the current edit cell.
                                if ( cells[c].index == ui.columnIndex && cells[c].rowIndex == ui.rowID )
                                {
                                    var col = inIUDiv.igGrid( "option", "columns" );
                                    var valu = formater( col[cells[c].index].dataType, ui.value, ui.oldValue );
                                    if ( valu == "" ) valu = ui.oldValue;
                                    var aCell = inIUDiv.igGrid( "activeCell" );
                                    ui.owner.setCellValue( aCell.rowIndex, aCell.columnKey, valu )
                                }
                                else
                                {//edit cell only
                                    var col = inIUDiv.igGrid( "option", "columns" );
                                    var val = formater( col[cells[c].index].dataType, ui.value, inIUDiv.igGrid( "getCellText", cells[c].rowIndex, cells[c].columnKey ) );//last parm is for custom fileds.
                                    if ( val != "" ) ui.owner.setCellValue( cells[c].rowIndex, cells[c].columnKey, val )
                                }
                            }
                        }
                        else
                        {
                            //fix the active selected field
                            var col = inIUDiv.igGrid( "option", "columns" );
                            ui.value = formater( col[ui.columnIndex].dataType, ui.value, ui.oldValue );//last parm is for custom fileds.
                            if ( ui.value == "" ) ui.value = ui.oldValue;
                            ui.owner.setCellValue( ui.rowID, ui.columnKey, ui.value )
                        }

                        INSTANCE.igGridSelection.clearSelection();
                        INSTANCE.editing = false;//flag for event
                        INSTANCE.updateDataCells( 35 );
                    }
                },
                {
                    name: "Sorting",
                    columnSorting: function ( evt, ui )
                    {
                        INSTANCE.igGridSelection.clearSelection();
                        var col = ui.owner.grid.columnByText( ui.columnKey );
                        var colIndex = 0;//temp fix
                        for ( var c = 1; c <INSTANCE.gridIDMap.option( "columns" ).length; c++ )
                        {
                            if ( INSTANCE.gridIDMap.option( "columns" )[c].key == ui.columnKey ) colIndex = c;
                        }
                    
                        if ( col.headerText == _spaceChar )//selects all cells
                        {
                            for ( var i = ui.owner.grid.allRows().length+1; i > -1; i-- )
                            {
                                for ( var j = INSTANCE.gridIDMap.option( "columns" ).length -1; j > 0 ; j-- )
                                {

                                    INSTANCE.igGridSelection.selectCell( i, j );
                                }
                            }

                            document.getElementById( "myDiv"+ INSTANCE.ID+"_table_ " ).className = "ui-widget-header-leftCell";// hack, not even sure why I need this but the fix in headerRendered gets overwritten some where
                        }
                        else //selects a collumn
                        {
                            for ( var i = ui.owner.grid.allRows().length-1; i > -1; i-- )
                                INSTANCE.igGridSelection.selectCell( i, colIndex );
                        }
                        return false;
                    }
                }
                ], headerCellRendered: function ( evt, ui )
                {

                }, headerRendered: function ( evt, ui )
                {
                    var gridID = ui.owner.id();
                    var x=0;
                    while ( $( ui.table ).find( "tr:eq(0) > th:eq(" + x + ") " )[0] )//loop all cells in the header
                    {
                        data = $( ui.table ).find( "tr:eq(0) > th:eq(" + x + ") " );//get the html element of the cell from jquery
                        data[0].title = "";//clear the Tool tip

                        //
                        //
                        //ui-iggrid-header ui-widget-header ui-draggable ui-iggrid-sortableheader ui-state-default

                        if ( data[0].innerHTML.indexOf( '-headertext">'+_spaceChar+'<'> -1 )
                            data[0].className = " ui-widget-header-leftCell ";//empty cells are grey ( only the first can be empty ), also size is now 0
                        x++;
                    }

                },
                
                dataRendered: function ( evt, ui )
                {//init after grid is ready
                    
                    var gridID = ui.owner.id();
                    INSTANCE.gridIDMap = $( "#" + gridID ).data( 'igGrid' )
                    INSTANCE.igGridSelection = $( "#" + gridID ).data( 'igGridSelection' );
                    INSTANCE.igGridSorting = $( "#" + gridID ).data( 'igGridSorting' );
                    INSTANCE.igGridUpdating = $( "#" + gridID ).data( 'igGridUpdating' );
                    INSTANCE.igGridResizing = $( "#" + gridID ).data( 'igGridResizing' );
                   
                    //fix up the column sizes
                    var rows = INSTANCE.gridIDMap.allRows().length; //should match length not length - 1
                    
                    var cellTotalSize =  INSTANCE.updateDataCells( 35 );//fix up the cells and return the highest length of the data not the rows or headers.
                    //now fix all sizes.
                    var xTotalSize = 0;
                    var yTotalSize = 0;
                    for ( var c = 0; c < INSTANCE.gridIDMap .option("columns" ).length; c++ )
                    {
                        INSTANCE.igGridResizing.resize( c, cellTotalSize[c] );//resize with cellTotalSize
                        xTotalSize += INSTANCE.gridIDMap.cellAt( c, 0 ).offsetWidth//now add up an entire row to get the final length
                        xTotalSize += 7;//room for scroll
                    }
                     
                    yTotalSize = ( rows + 1/* header*/ ) * $( "#" + gridID + ">tbody>tr:eq(0)" ).height();// add a row for the header and times by the height of the first row.
                    yTotalSize += 7;//room for scroll
                    INSTANCE.fixedGridWidth = xTotalSize;
                    INSTANCE.fixedGridHeight = yTotalSize
                    INSTANCE.gridIDMap.option("width", xTotalSize );
                    INSTANCE.gridIDMap.option( "height", yTotalSize );
                    INSTANCE.updateWindowSize( inWidth, inHeight );

                    //fix last column row for scalars
                    
                    
                    //ugly but all we got, always going to puch 20 over so bars can not eat up the text. Effects all grid and it must ( dont chage that )
                    //if (INSTANCE.scalar ) //put this back and it will break small grids.
                    {
                         $( "#" + gridID + '>tbody>tr' ).each( function ()
                        {
                             var lasttd = $( this ).find( 'td:last' );
                             lasttd.css( "padding-right", "20px" );
                        } );
                    }

                }
            } );
        } );
    };

Parents
No Data
Reply
  • 24671
    posted

    Hi,

    that's strange. Several things you can try:

    1) try instantiating the grid on a <table> instead of a <div>, and see if it makes any difference (it shouldn't)

    2) could you check by loading the minified and combined files, without using the loader?

    3) You can try removing features (one by one, if nothing else helps), and see if it will make any difference

    by the way, i am not sure why you have column resizing defined, but you are always cancelling the resizing event? 

    Thanks,

    Angel

Children