How to create a grid on click event
I try to create a grid after the user click a button, but it doesn't work for the following code:
<head>
<style>
.active-controls-grid {height: 100%; font: menu;}
.active-column-0 {width: 80px;}
.active-column-1 {width: 200px;}
.active-column-2 {text-align: right;}
.active-column-3 {text-align: right;}
.active-column-4 {text-align: right;}
</style>
</head>
<script>
function create()
{
var myData = [
["MSFT","Microsoft", "314,571.156", "32,187.000", "55000"],
["ORCL", "Oracle", "62,615.266", "9,519.000", "40650"],
["KNM", "Konami (ADR)", "3,710.784", ".000", "4313"]
];
var myColumns = ["Ticker", "Company Name", "Market Cap.", "$ Sales", "Employees"];
var obj = new Active.Controls.Grid;
obj.setRowProperty("count", 20);
obj.setColumnProperty("count", 5);
obj.setDataProperty("text", function(i, j){return myData[i][j]});
obj.setColumnProperty("text", function(i){return myColumns[i]});
obj.setRowHeaderWidth("28px");
obj.setColumnHeaderHeight("20px");
obj.setAction("click", function(src){window.status = src.getItemProperty("text")});
document.write(obj);
}
</script>
<body>
<p><a href="javascript:create()">creategrid</a></p>
</body>
Any comments are highly appreciated.
<head>
<style>
.active-controls-grid {height: 100%; font: menu;}
.active-column-0 {width: 80px;}
.active-column-1 {width: 200px;}
.active-column-2 {text-align: right;}
.active-column-3 {text-align: right;}
.active-column-4 {text-align: right;}
</style>
</head>
<script>
function create()
{
var myData = [
["MSFT","Microsoft", "314,571.156", "32,187.000", "55000"],
["ORCL", "Oracle", "62,615.266", "9,519.000", "40650"],
["KNM", "Konami (ADR)", "3,710.784", ".000", "4313"]
];
var myColumns = ["Ticker", "Company Name", "Market Cap.", "$ Sales", "Employees"];
var obj = new Active.Controls.Grid;
obj.setRowProperty("count", 20);
obj.setColumnProperty("count", 5);
obj.setDataProperty("text", function(i, j){return myData[i][j]});
obj.setColumnProperty("text", function(i){return myColumns[i]});
obj.setRowHeaderWidth("28px");
obj.setColumnHeaderHeight("20px");
obj.setAction("click", function(src){window.status = src.getItemProperty("text")});
document.write(obj);
}
</script>
<body>
<p><a href="javascript:create()">creategrid</a></p>
</body>
Any comments are highly appreciated.
tom
August 23,