:: Forum >> Version 2 >>
Issue with Grid updating within nested DIVs?
Is there an known issue with Grid updating when the Grid is located within nested DIVs?
I have a number of popups which are filled either by XML Requests or directly with SetCellText and all exhibit the same behaviour.
The first time they are created and data loaded in around 50% of the cases the grids are blank. In subsequent calls when the data is just being loaded the grid always work perfectly.
Example code:
// Creates a Result Grid
function _CreateGrid(inObject)
{
document.write("<div id=\"divResultPopup\" class=\"result_popup\">");
// The grid
this.itsGrid = new AW.UI.Grid;
this.itsGrid.setId('gridResultPopup');
this.itsGrid.setColumnCount(2);
this.itsGrid.setRowCount(3);
this.itsGrid.setHeaderText(['Update','Result']);
this.itsGrid.setSize(300,100);
this.itsGrid.setColumnWidth(180,1);
this.itsGrid.setSelectionMode("single-row");
document.write("<p></p>"+this.itsGrid);
document.write("</div>");
hideDiv("divResultPopup");
}
function _LoadData(inIP, inOneResult, inTwoResult, inCFResult)
{
showDiv("divResultPopup");
this.itsGrid.setRowCount(3);
this.itsGrid.setCellText("One",0,0);
this.itsGrid.setCellText("Two",0,1);
this.itsGrid.setCellText("Custom Fields",0,2);
this.itsGrid.setCellText(inOneResult,1,0);
this.itsGrid.setCellText(inTwoPResult,1,1);
this.itsGrid.setCellText(inCFResult,1,2);
// Set the background
for (var i = 0; i < 3; i++)
{
var theColour;
if (this.itsGrid.getCellText(1,i).indexOf('Success: ') > -1)
theColour = 'CCFF33';
else if (this.itsGrid.getCellText(1,i).indexOf('Error: ') > -1)
theColour = 'FF4242';
else
theColour = 'FFFF80';
this.itsGrid.getRowTemplate(i).setStyle('background-color',theColour);
}
}
It did not matter if I refreshed the grid was .refreshed after the load, infact it seemed to make the problem worse.
Karl Thoroddsen
Thursday, November 2, 2006
Karl,
this may happen if one of the parent divs has display:none style. In this case the grid does not initialize correctly (in 2.0.1). The possible workaround is to use visibility:hidden instead of display:none or insert the grid after the div becomes visible.
Alex (ActiveWidgets)
Monday, November 6, 2006
Thanks Alex, that was probably the case.
Karl Thoroddsen
Monday, November 6, 2006
This topic is archived.
Back to support forum
Forum search