3.0.5

grid data undefined repeatable error

2.0b4 on ie6, virtual mode off

_ load a grid with 500 rows
_ sort on a column
_ reload the grid with 15 rows
_ all the data in the grid says "undefined"


initial grid definition:
var gridCdmItems = new AW.Grid.Extended;
gridCdmItems.setSize(600, 300);
gridCdmItems.setColumnCount( cdmItemsColumnCount );
gridCdmItems.setRowCount( cdmItemsRowCount );
gridCdmItems.setCellText( function( ixCol, ixRow ){ return aarCdmItems[arrDbColumnNames[ixCol]][ixRow] } );
gridCdmItems.setHeaderText( function( ix ){ return arrColumnNames[ix] } );
gridCdmItems.setSelectorVisible(true);
gridCdmItems.setSelectorText(function(ixRow){return this.getRowPosition(ixRow)+1});
gridCdmItems.setFixedLeft( 1 );
gridCdmItems.setVirtualMode( false );
gridCdmItems.setSelectorProperty( 'width', 30 );
document.getElementById( 'cdmItemsCount' ).innerText = cdmItemsRowCount;
document.write( gridCdmItems );


code that reloads the grid:
getCdmItems( document.getElementById( 'cdmId' ).value,
document.getElementById( 'numCdmItems' ).value );

gridCdmItems.setRowCount( cdmItemsRowCount );
gridCdmItems.setColumnCount( cdmItemsColumnCount );
gridCdmItems.setCellText( function( ixCol, ixRow ){ return aarCdmItems[arrDbColumnNames[ixCol]][ixRow] } );
gridCdmItems.refresh();
document.getElementById( 'cdmItemsCount' ).innerText = cdmItemsRowCount;
muley88
January 31,
What is this line supposed to do? Or more precisely, what do you think it does?

getCdmItems( document.getElementById( 'cdmId' ).value,
document.getElementById( 'numCdmItems' ).value );


Also, what does the array look like that you are trying to use? It might help to see the data as your setCellText line looks funny in that it is addressing the aarCdmItems array with a [string][number] nomenclature. This in itself is not bad, if the data is set up that way. So it would be nice to see a few rows of the data to know what is going on.
Jim Hunter
January 31,
Jim,

Thanks for looking at this.

The function getCdmItems is retrieving data from a database into a javascript associative array which is organized as an associative array of column names, with each of those arrays containing an indexed array of row values. In other words, the data is organized by columns, not by rows. That's why the setCellText function looks the way it does. The getCdmItems function was called to initially get data for the grid too, I just didn't show it above, though I should have to avoid confusion.

It's not an issue of getting some data into the grid with this arrangement. This has been working for about two weeks. There is some issue with sorting, then retrieving new data with fewer rows that the grid was holding last time data was retrieved.
Jim D.
January 31,
then I suggest clearing the grid before assigning new data.

gridCdmItems.clear();


You will probably have to setup some of the properties again, but it might beat spinning your wheels trying to figure out what the issue here is.



Jim Hunter
January 31,

This topic is archived.

See also:


Back to support forum