3.2.0

Using Radio buttons to dynamically display Grids

Hi,

I have two grids which I would like the user to be able to choose between using Radio Buttons. I have provided a simple example below of how I thought this should work (inferring from the Docco), but it doesn't. Each of the functions 'writeGrid1()' and 'writeGrid1()' test OK when called alone, but when I place them in a 'onSelectedItemsChanging' function as per below, I just get the cell contents without any formatting..(my Firefox Java console tells me it can't find the aw.css for the XP style..?). Have I misunderstood something here..??

Thanks
Martin


<html>
<head>
<!-- include AW stylesheet and script -->
<link href="runtime/styles/xp/aw.css" rel="stylesheet" type="text/css" ></link>
<script src="runtime/lib/aw.js"></script>
</head>
<body>
<script>
function writeGrid1()
{
var obj = new AW.UI.Grid;
obj.setCellText("123");
obj.setHeaderText("abc");
obj.setColumnCount(10);
obj.setRowCount(10);
obj.setPosition(200, 30);
document.write(obj);
}


function writeGrid2()
{
var obj = new AW.UI.Grid;
obj.setCellText("456");
obj.setHeaderText("def");
obj.setColumnCount(5);
obj.setRowCount(5);
obj.setPosition(200, 30);
document.write(obj);
}


var myRadioGroup = new AW.UI.Radio;
myRadioGroup.setItemText(["First Grid", "Second Grid"]);
myRadioGroup.setPosition(0, 30);
myRadioGroup.setItemImage(["favorites", "fontsize"]);
myRadioGroup.setItemCount(2);
myRadioGroup.setSelectedItems([0]);


var value = myRadioGroup.getSelectedItems();
myRadioGroup.setSelectedItems(value);
myRadioGroup.onSelectedItemsChanging = function(value)
{
if(value == 0) { writeGrid1(); }
if(value == 1) { writeGrid2(); }
}

document.write(myRadioGroup);
</script>
</body>
</html>
Martin
September 11,

This topic is archived.

See also:


Back to support forum